-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
Span for unused_macros lint is too large, which makes writing macros in IDEs annoying #90745
Copy link
Copy link
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: 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.Relevant to the compiler team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: 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.Relevant to the compiler team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Given the following code (playground):
The current output is:
Note how the span for the
unused_macroslint covers the entire macro definition. This is fine for terminal diagnostic output, but when using an IDE or a Rust language server, this causes the entire macro definition to be underlined with yellow:In my experience, this tends to make writing macros obnoxious without allowing
unused_macros(either globally or locally).Ideally, the span for this lint should be reduced to the macro's identifier, similar to how the
dead_codelint's span only highlightsbar's identifier:@rustbot modify labels: +A-macros +C-enhancement