discriminant value on non-field-less enum should highlight variant with field #61039
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
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:
rust/src/test/ui/parser/tag-variant-disr-non-nullary.rs
Line 8 in 37ff5d3
(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.)
The text was updated successfully, but these errors were encountered: