Skip to content

Use attribute parser for deprecated attribute checking - #160459

Open
obeis wants to merge 1 commit into
rust-lang:mainfrom
obeis:check_deprecated
Open

Use attribute parser for deprecated attribute checking#160459
obeis wants to merge 1 commit into
rust-lang:mainfrom
obeis:check_deprecated

Conversation

@obeis

@obeis obeis commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

@rustbot

rustbot commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

Some changes occurred in compiler/rustc_attr_parsing

cc @jdonszelmann, @JonathanBrouwer

Some changes occurred in compiler/rustc_passes/src/check_attr.rs

cc @jdonszelmann, @JonathanBrouwer

@rustbot rustbot added A-attributes Area: Attributes (`#[…]`, `#![…]`) S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Aug 3, 2026
@obeis obeis changed the title Use attribute parser for deprecated attribute checking Use attribute parser for deprecated attribute checking Aug 3, 2026
@obeis
obeis force-pushed the check_deprecated branch from db4cd0d to 309ea35 Compare August 3, 2026 19:10
@rust-log-analyzer

This comment has been minimized.

@obeis
obeis force-pushed the check_deprecated branch from 309ea35 to aaa1340 Compare August 3, 2026 20:36
@rust-log-analyzer

This comment has been minimized.

Comment thread compiler/rustc_hir/src/target.rs Outdated
let attr_span = cx.attr_span;
cx.emit_lint(
UNUSED_ATTRIBUTES,
DeprecatedAnnotationHasNoEffect { span: attr_span },

@JonathanBrouwer JonathanBrouwer Aug 7, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need to be its own diagnostic rather than just the default Policy::Warn diagnostic?

View changes since the review

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread compiler/rustc_attr_parsing/src/attributes/deprecation.rs
@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 7, 2026
@rustbot

rustbot commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@rust-bors

This comment has been minimized.

@obeis
obeis force-pushed the check_deprecated branch from aaa1340 to 111bef3 Compare August 15, 2026 13:29
@rustbot

rustbot commented Aug 15, 2026

Copy link
Copy Markdown
Collaborator

Some changes occurred in compiler/rustc_attr_ir

cc @jdonszelmann, @JonathanBrouwer

@rustbot

rustbot commented Aug 15, 2026

Copy link
Copy Markdown
Collaborator

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.

@obeis
obeis requested a review from JonathanBrouwer August 15, 2026 13:31
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Aug 15, 2026
};
if containing_impl_is_for_trait {
Target::Method(MethodKind::Trait { body: true })
Target::Method(MethodKind::TraitImpl)

@JonathanBrouwer JonathanBrouwer Aug 20, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

View changes since the review

| Target::Closure
| Target::Method(MethodKind::Trait { body: true } | MethodKind::Inherent) => {
| Target::Method(
MethodKind::Trait { body: true } | MethodKind::TraitImpl | MethodKind::Inherent,

@JonathanBrouwer JonathanBrouwer Aug 20, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Together with this change

View changes since the review

Target::Fn
| Target::Method(MethodKind::Trait { body: true } | MethodKind::Inherent) => {
| Target::Method(
MethodKind::Trait { body: true } | MethodKind::TraitImpl | MethodKind::Inherent,

@JonathanBrouwer JonathanBrouwer Aug 20, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JonathanBrouwer JonathanBrouwer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r=me after that
@rustbot author

View changes since this review

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-attributes Area: Attributes (`#[…]`, `#![…]`) S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants