Skip to content

Conversation

@nik-rev
Copy link
Contributor

@nik-rev nik-rev commented Jan 15, 2026

Adds a future-compatibility-warning deny-by-default lint that helps catch invalid derive helper attribute names early.

This issues the lint, saying that ignore helper will clash with the built-in ignore attribute.

#![crate_type = "proc-macro"]
#![deny(ambiguous_derive_helpers)] 
use proc_macro::TokenStream; 

#[proc_macro_derive(Trait, attributes(ignore))]
pub fn example(input: TokenStream) -> TokenStream {
    TokenStream::new()
}

If you actually tried to use that ignore helper attribute, you won't be able to due to the ambiguity:

#[derive(Trait)]
struct Foo {
    #[ignore]
    field: (),
}

Produces:

error[E0659]: `ignore` is ambiguous
 --> src/lib.rs:5:7
  |
5 |     #[ignore]
  |       ^^^^^^ ambiguous name
  |
  = note: ambiguous because of a name conflict with a builtin attribute
  = note: `ignore` could refer to a built-in attribute
note: `ignore` could also refer to the derive helper attribute defined here
 --> src/lib.rs:3:10
  |
3 | #[derive(Trait)]
  |          ^^^^^

@rustbot
Copy link
Collaborator

rustbot commented Jan 15, 2026

Some changes occurred in compiler/rustc_attr_parsing

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 Jan 15, 2026
@rustbot
Copy link
Collaborator

rustbot commented Jan 15, 2026

r? @chenyukang

rustbot has assigned @chenyukang.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rust-log-analyzer

This comment has been minimized.

@nik-rev nik-rev force-pushed the helper_attr_builtin branch 2 times, most recently from 54147eb to c9b7a07 Compare January 15, 2026 04:02
@rustbot

This comment has been minimized.

@nik-rev nik-rev requested a review from chenyukang January 18, 2026 02:14
@chenyukang
Copy link
Member

@bors r=chenyukang

@rust-bors
Copy link
Contributor

rust-bors bot commented Jan 18, 2026

📌 Commit 4dda363 has been approved by chenyukang

It is now in the queue for this repository.

@rust-bors rust-bors bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 18, 2026
@petrochenkov
Copy link
Contributor

New deprecation lints go through language team process, and the lint name also doesn't follow naming conventions.

@chenyukang
Copy link
Member

@bors r-

@rust-bors rust-bors bot added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Jan 18, 2026
@rust-bors
Copy link
Contributor

rust-bors bot commented Jan 18, 2026

Commit 4dda363 has been unapproved.

@rust-bors rust-bors bot removed the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Jan 18, 2026
@nik-rev
Copy link
Contributor Author

nik-rev commented Jan 18, 2026

@rustbot label +I-lang-nominated

I am nominating this for lang-team attention.

What name should this lint have? The current name doesn't follow the naming conventions

My main idea is allow(derive_helper_attr_with_same_name_as_a_builtin_attr), but that's quite long

@rustbot rustbot added the I-lang-nominated Nominated for discussion during a lang team meeting. label Jan 18, 2026
@rust-bors

This comment has been minimized.

@traviscross traviscross added T-lang Relevant to the language team needs-fcp This change is insta-stable, or significant enough to need a team FCP to proceed. labels Jan 21, 2026
@traviscross traviscross added the P-lang-drag-1 Lang team prioritization drag level 1. https://rust-lang.zulipchat.com/#narrow/channel/410516-t-lang label Jan 21, 2026
@joshtriplett
Copy link
Member

The FCW lint seems reasonable.

@rfcbot merge lang

@rust-rfcbot
Copy link
Collaborator

rust-rfcbot commented Jan 21, 2026

Team member @joshtriplett has proposed to merge this. The next step is review by the rest of the tagged team members:

Concerns:

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!

cc @rust-lang/lang-advisors: FCP proposed for lang, please feel free to register concerns.
See this document for info about what commands tagged team members can give me.

@rust-rfcbot rust-rfcbot added proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. labels Jan 21, 2026
@traviscross
Copy link
Contributor

@rfcbot concern name

We need to spend a few minutes reviewing the name.

@tmandry
Copy link
Member

tmandry commented Jan 21, 2026

@rfcbot reviewed

@Darksonn
Copy link
Member

How about this name? ambiguous_derive_macro_attribute

@rustbot
Copy link
Collaborator

rustbot commented Jan 22, 2026

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

@nik-rev nik-rev force-pushed the helper_attr_builtin branch from 4dda363 to 3e42d72 Compare January 22, 2026 21:12
@rustbot
Copy link
Collaborator

rustbot commented Jan 22, 2026

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.

@nik-rev
Copy link
Contributor Author

nik-rev commented Jan 22, 2026

@rustbot ready

@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 Jan 22, 2026
@nik-rev nik-rev force-pushed the helper_attr_builtin branch from 3e42d72 to a822dd5 Compare January 22, 2026 21:28
Copy link
Contributor

@traviscross traviscross left a comment

Choose a reason for hiding this comment

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

Looks reasonable to me.

View changes since this review

@traviscross
Copy link
Contributor

Thanks.

@rfcbot resolve name

@traviscross
Copy link
Contributor

@rfcbot reviewed

@rust-rfcbot rust-rfcbot added final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. and removed proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. labels Jan 22, 2026
@rust-rfcbot
Copy link
Collaborator

🔔 This is now entering its final comment period, as per the review above. 🔔

@traviscross traviscross removed I-lang-nominated Nominated for discussion during a lang team meeting. P-lang-drag-1 Lang team prioritization drag level 1. https://rust-lang.zulipchat.com/#narrow/channel/410516-t-lang labels Jan 22, 2026
@rust-rfcbot rust-rfcbot added finished-final-comment-period The final comment period is finished for this PR / Issue. to-announce Announce this issue on triage meeting and removed final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. labels Feb 1, 2026
@rust-rfcbot
Copy link
Collaborator

The final comment period, with a disposition to merge, as per the review above, is now complete.

As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-attributes Area: Attributes (`#[…]`, `#![…]`) disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. finished-final-comment-period The final comment period is finished for this PR / Issue. I-lang-radar Items that are on lang's radar and will need eventual work or consideration. needs-fcp This change is insta-stable, or significant enough to need a team FCP to proceed. 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. T-lang Relevant to the language team to-announce Announce this issue on triage meeting

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants