Skip to content

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

Closed
@nnethercote

Description

@nnethercote

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.

Metadata

Metadata

Assignees

Labels

A-diagnosticsArea: Messages for errors, warnings, and lintsD-papercutDiagnostics: An error or lint that needs small tweaks.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.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