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(derive_helper_clashes_with_builtin_attr)] 
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
@nik-rev nik-rev force-pushed the helper_attr_builtin branch from c9b7a07 to 4dda363 Compare January 18, 2026 02:11
@rustbot
Copy link
Collaborator

rustbot commented Jan 18, 2026

⚠️ Warning ⚠️

@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
Copy link
Contributor

rust-bors bot commented Jan 20, 2026

☔ The latest upstream changes (presumably #151381) made this pull request unmergeable. Please resolve the merge conflicts.

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

Labels

A-attributes Area: Attributes (`#[…]`, `#![…]`) I-lang-nominated Nominated for discussion during a lang team meeting. 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.

5 participants