Skip to content

discriminant value on non-field-less enum should highlight variant with field #61039

Closed

Description

While reviewing PR #60732, I noticed that both the current stderr for test cases like tag-variant-disr-non-nullary.stderr highlights a bunch of variants that all have no fields on them.

This is confusing, because the diagnostic is complaining that you can only use this feature on enums without fields, but the diagnostic is showing you only cases without fields. Ideally it would include both the explicit discriminator value and some variant of the enum that has fields on it. For example, in the case linked above, it would also highlight the variant on this line:

(Arguably if rust-lang/rfcs#2363 (#60553) gets implemented and stabilized quickly, the diagnostic being criticized here will go away, and my suggestion will be pointless. But I suspect this would be an easy change to make that would make life easier for some developers.)

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 lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions