Use attribute parser for deprecated attribute checking - #160459
Conversation
|
Some changes occurred in compiler/rustc_attr_parsing cc @jdonszelmann, @JonathanBrouwer Some changes occurred in compiler/rustc_passes/src/check_attr.rs |
deprecated attribute checking
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
| let attr_span = cx.attr_span; | ||
| cx.emit_lint( | ||
| UNUSED_ATTRIBUTES, | ||
| DeprecatedAnnotationHasNoEffect { span: attr_span }, |
There was a problem hiding this comment.
Does this need to be its own diagnostic rather than just the default Policy::Warn diagnostic?
There was a problem hiding this comment.
I think using UNUSED_ATTRIBUTES is better here because it's indicates that the attribute "has no effect" rather than saying it has a "wrong target" which is a better fit for unused attributes and unused lint group.
|
Reminder, once the PR becomes ready for a review, use |
This comment has been minimized.
This comment has been minimized.
aaa1340 to
111bef3
Compare
|
Some changes occurred in compiler/rustc_attr_ir |
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
| }; | ||
| if containing_impl_is_for_trait { | ||
| Target::Method(MethodKind::Trait { body: true }) | ||
| Target::Method(MethodKind::TraitImpl) |
There was a problem hiding this comment.
While this change is correct, this is an independent change so please split this into a separate commit.
This is nicer for review (for in the future) and nicer in case someone stumbles on this PR and needs to figure out what it does
| | Target::Closure | ||
| | Target::Method(MethodKind::Trait { body: true } | MethodKind::Inherent) => { | ||
| | Target::Method( | ||
| MethodKind::Trait { body: true } | MethodKind::TraitImpl | MethodKind::Inherent, |
There was a problem hiding this comment.
Together with this change
| Target::Fn | ||
| | Target::Method(MethodKind::Trait { body: true } | MethodKind::Inherent) => { | ||
| | Target::Method( | ||
| MethodKind::Trait { body: true } | MethodKind::TraitImpl | MethodKind::Inherent, |
There was a problem hiding this comment.
and this change
Updates #153101
r? @JonathanBrouwer