-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Split up the unknown_or_malformed_diagnostic_attributes
lint
#140717
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
base: master
Are you sure you want to change the base?
Conversation
Some changes occurred in compiler/rustc_passes/src/check_attr.rs |
I know creating a new lint requires lang team approval, but I'm unsure if splitting a lint needs it. @rustbot labels +I-lang-nominated |
#[derive(LintDiagnostic)] | ||
#[diag(trait_selection_ignored_diagnostic_option)] | ||
pub struct IgnoredDiagnosticOption { | ||
pub option_name: &'static str, | ||
#[label] | ||
pub span: Span, | ||
#[label(trait_selection_other_label)] | ||
pub prev_span: Span, | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a duplicate of the one in ../on_unimplemented.rs
, I think I accidentally copy pasted it in the past 😞
This comment has been minimized.
This comment has been minimized.
This comment was marked as off-topic.
This comment was marked as off-topic.
This seems consistent with how @rfcbot merge |
Team member @joshtriplett has proposed to merge this. The next step is review by the rest of the tagged team members: No concerns currently listed. Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
@rfcbot reviewed |
This splits up the lint into the following lint group:
unknown_diagnostic_attributes
- triggers if the attribute is unknown to the current compilermisplaced_diagnostic_attributes
- triggers if the attribute exists but it is not placed on the item kind it's meant formalformed_diagnostic_attributes
- triggers if the attribute's syntax or options are invalidmalformed_diagnostic_format_literals
- triggers if the format string literal is invalid, for example if it has unpaired curly braces or invalid parametersThis PR does not start emitting lints in places that previously did not.
Motivation
I want to have finer control over what
unknown_or_malformed_diagnostic_attributes
doesI have a project with fairly low msrv that is/will have a lower msrv than future diagnostic attributes. So lints will be emitted when I or others compile it on a lower msrv.
At this time, there are two options to silence these lints:
#[allow(unknown_or_malformed_diagnostic_attributes)]
- this risks diagnostic regressions if I (or others) mess up using the attribute, or if the attribute's syntax ever changes.allow
the lint:I like to avoid using build scripts if I can, so the following works much better for me. That is what this PR will let me do in the future: