Skip to content

Confusing error when populating a struct with a field called 'start' without an explicit value and a variable called start is not defined #86290

@jjl

Description

@jjl

Given the following code:

struct Wat {
    start: (),
}
impl Wat {
    fn new() -> Wat {
      Wat { start }
    }
}

The current output is:

expected value, found built-in attribute `start`
a field by this name exists in `Self` [E0423]

I frankly have no idea what it's on about and I was surprised that it doesn't just tell me it can't find the variable of that name.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions