Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
petrochenkov opened this issue Jun 25, 2019 · 0 comments · Fixed by #62133
Closed
Assignees
Labels
A-attributes Area: #[attributes(..)] A-resolve Area: Path resolution A-stability Area: issues related to #[stable] and #[unstable] attributes themselves. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-lang Relevant to the language team, which will review and decide on the PR/issue.

Comments

@petrochenkov
Copy link
Contributor

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.
@petrochenkov petrochenkov self-assigned this Jun 25, 2019
@petrochenkov petrochenkov added A-attributes Area: #[attributes(..)] A-resolve Area: Path resolution A-stability Area: issues related to #[stable] and #[unstable] attributes themselves. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-lang Relevant to the language team, which will review and decide on the PR/issue. labels Jun 25, 2019
bors added a commit that referenced this issue Jun 25, 2019
Feature gate `rustc` attributes harder

cc #62116
Centril added a commit to Centril/rust that referenced this issue Jul 1, 2019
Manishearth added a commit to Manishearth/rust that referenced this issue Jul 2, 2019
Mark-Simulacrum added a commit to Mark-Simulacrum/rust that referenced this issue Jul 3, 2019
Centril added a commit to Centril/rust that referenced this issue Jul 4, 2019
Mark-Simulacrum added a commit to Mark-Simulacrum/rust that referenced this issue Jul 4, 2019
Mark-Simulacrum added a commit to Mark-Simulacrum/rust that referenced this issue Jul 4, 2019
Centril added a commit to Centril/rust that referenced this issue Jul 5, 2019
Centril added a commit to Centril/rust that referenced this issue Jul 5, 2019
Centril added a commit to Centril/rust that referenced this issue Jul 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-attributes Area: #[attributes(..)] A-resolve Area: Path resolution A-stability Area: issues related to #[stable] and #[unstable] attributes themselves. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-lang Relevant to the language team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant