Repository navigation
Built-in attributes are treated differently vs prelude attributes, unstable built-in attributes can name-collide with stable macro, and built-in attributes can break back-compat #134963
Description
Activity
- addedA-attributesArea: Attributes (`#[…]`, `#![…]`)Area: Attributes (`#[…]`, `#![…]`)A-stabilityArea: `#[stable]`, `#[unstable]` etc.Area: `#[stable]`, `#[unstable]` etc.C-discussionCategory: Discussion or questions that doesn't represent real issues.Category: Discussion or questions that doesn't represent real issues.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.T-langRelevant to the language teamRelevant to the language team
on Dec 31, 2024 - addedneeds-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triagingThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
on Dec 31, 2024 - removedneeds-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triagingThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
on Dec 31, 2024 Nominating for T-compiler discussion, mostly for awareness and if there's anything actionable (feel free to postpone this until holiday is over, just putting it in the nomination queue).
@rustbot label +I-compiler-nominated
- addedI-compiler-nominatedNominated for discussion during a compiler team meeting.Nominated for discussion during a compiler team meeting.
on Dec 31, 2024 - addedI-lang-nominatedNominated for discussion during a lang team meeting.Nominated for discussion during a lang team meeting.
on Dec 31, 2024 - addedA-resolveArea: Name/path resolution done by `rustc_resolve` specificallyArea: Name/path resolution done by `rustc_resolve` specifically
on Jan 2, 2025 We briefly looked at this during T-compiler triage on Zulip.
One question was what is precisely meant by stability of the built-ins to rustc, seems we don't have a good summary for it, we should probably have this behaviour documented somewhere.
Removing the nomination for now. In case feel free to nominate for T-compiler discussion again.
@rustbot label -I-compiler-nominated- removedI-compiler-nominatedNominated for discussion during a compiler team meeting.Nominated for discussion during a compiler team meeting.
on Jan 15, 2025 #53913 has relevant information about the current behavior.
Reacted by 许杰友 Jieyou Xu (Joe)- addedI-lang-radarItems that are on lang's radar and will need eventual work or consideration.Items that are on lang's radar and will need eventual work or consideration.and removedI-lang-nominatedNominated for discussion during a lang team meeting.Nominated for discussion during a lang team meeting.
on Jan 27, 2025 - addedA-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)
on Jul 15, 2025 cc #133708
Reacted by KanashimiaRelated discussion: #t-lang > Name Res: questions on intended behavior @ 💬
Here's an explanation of the original change that did this (the ticket is linked above, but this is the specific comment):
#53913 (comment)- added a commit that references this issue
on Aug 6, 2026
Example breakage: Broken build after updating:
coverageis ambiguous; ambiguous because of a name conflict with a builtin attributeExample code:
Originally posted by @ehuss in #121157
This is an interesting problem that has three aspects:
#[coverage(..)]are handled differently versus prelude attributes like#[test], including name resolution.#[coverage]) can still break stable code without any feature gates (e.g.useof a user-defined macro of the same name as the newly added built-in attribute).It might be tricky to change (or not possible), mostly opened this issue for awareness.