Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chance to improve "try ignoring the field" message #95795

Closed
nnethercote opened this issue Apr 8, 2022 · 4 comments · Fixed by #100031
Closed

Chance to improve "try ignoring the field" message #95795

nnethercote opened this issue Apr 8, 2022 · 4 comments · Fixed by #100031
Assignees
Labels
A-diagnostics Area: Messages for errors, warnings, and lints D-papercut Diagnostics: An error or lint that needs small tweaks. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@nnethercote
Copy link
Contributor

nnethercote commented Apr 8, 2022

I got this error message recently:

error: unused variable: `kind`
   --> compiler/rustc_expand/src/mbe/macro_parser.rs:700:59
    |
700 |             if let &MatcherLoc::MetaVarDecl { span, bind, kind, .. } = loc {
    |                                                           ^^^^ help: try ignoring the field: `kind: _`
    |
    = note: `-D unused-variables` implied by `-D warnings`

kind: _ will work, but just removing kind completely from the pattern would be better.

E.g. the suggestion could be help: try removing the field.

The particular example was within rustc, but it should be very easy to replicate in a self-contained example.

@nnethercote nnethercote added E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. D-papercut Diagnostics: An error or lint that needs small tweaks. labels Apr 8, 2022
@estebank estebank added the E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. label Apr 8, 2022
@lameferret
Copy link
Contributor

Is this [E0027]? Where does this suggestion come from? Can I please get the path for it!

@yuvaldolev
Copy link
Contributor

@rustbot claim

@booleancoercion
Copy link
Contributor

@yuvaldolev It's been 3 months - are you still working on this? If not, I'd like to claim it instead.

@GoldsteinE
Copy link
Contributor

There was no activity for a while, so I took a liberty of implementing this.

@rustbot claim

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Aug 15, 2022
… r=michaelwoerister

improve "try ignoring the field" diagnostic

Closes rust-lang#95795
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Aug 15, 2022
… r=michaelwoerister

improve "try ignoring the field" diagnostic

Closes rust-lang#95795
@bors bors closed this as completed in 3fb249b Aug 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints D-papercut Diagnostics: An error or lint that needs small tweaks. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants