Skip to content

Missing variables/fields give confusing error when name is the same as a built-in attribute like start or path #86290

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 lintsD-confusingDiagnostics: Confusing error or lint that should be reworked.D-newcomer-roadblockDiagnostics: Confusing error or lint; hard to understand for new users.D-papercutDiagnostics: An error or lint that needs small tweaks.E-help-wantedCall for participation: Help is requested to fix this issue.T-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