Skip to content

Elide use of "non-existing" fields for enum variant with parse errors #57361

Closed

Description

On parse error of the fields of an enum variant, we also emit an error about "non-existing" fields when using the variant. We have no way of actually knowing wether those fields exist, we should elide the second error:

error: expected `:`, found `,`
   --> src/librustc/traits/mod.rs:228:37
    |
228 |     MatchExpressionArmPattern { span, ty: Ty<'tcx> },
    |                                     ^ expected `:`

error[E0026]: variant `traits::ObligationCauseCode::MatchExpressionArmPattern` does not have fields named `span`, `ty`
   --> src/librustc/infer/error_reporting/mod.rs:464:62
    |
464 |             ObligationCauseCode::MatchExpressionArmPattern { span, ty } => {
    |                                                              ^^^^  ^^ variant `traits::ObligationCauseCode::MatchExpressionArmPattern` does not have these fields
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lints

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions