Skip to content

Attributes starting with rustc_ are supposed to be gated, but they are not always gated #62116

Closed
@petrochenkov

Description

@petrochenkov

Of course, the specific known built-in attributes like #[rustc_copy_clone_marker] are feature gated, but the rustc_* names are not reserved in general.
As a result, you can easily create a procedural macro attribute starting with rustc_.

As a result, introduction of a new built-in attribute is technically a breaking change even if the attribute starts with rustc_.

Q: Why is introduction of a new built-in attribute a breaking change.
A: Because built-in attributes will conflict with any other attributes in scope having the same name (see #53913 (comment) for some technical details).

Possible solutions:

  • Reserve (feature gate) any attributes starting with rustc_, including macros, run crater and see what happens.
  • Do nothing, this is not a big deal.
    • Third party attribute names are unlikely to start with rustc_.
    • We are going to add new non-rustc_* built-in attributes anyway and go through the same technically breaking changes in process.

Metadata

Metadata

Assignees

Labels

A-attributesArea: Attributes (`#[…]`, `#![…]`)A-resolveArea: Name/path resolution done by `rustc_resolve` specificallyA-stabilityArea: `#[stable]`, `#[unstable]` etc.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.T-langRelevant to the language team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions