-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Deny #[cfg] and #[cfg_attr] on generic parameters. #51283
Deny #[cfg] and #[cfg_attr] on generic parameters. #51283
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
💯 👍 Nominating this for the next lang meeting if it hasn't been resolved until then :) |
Ping from triage, @petrochenkov. This PR is waiting for your review. |
@bors r+ |
📌 Commit c9cb806 has been approved by |
@bors p=1 (needs to be backported into beta) |
This seems like a no brainer. Approving also for beta backport. |
⌛ Testing commit c9cb806 with merge d08d9e1a1f4be50a2000dea5f998ae613c690150... |
💔 Test failed - status-travis |
Your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem. Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
Your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem. Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
⌛ Testing commit c9cb806 with merge 56e5871eac206e05cf0d3db3799a0ffb994042f5... |
💔 Test failed - status-travis |
@bors retry (the tree was closed, PR killed by cancelbot) |
…ng-song-and-dance, r=nikomatsakis Deny #[cfg] and #[cfg_attr] on generic parameters. Fix rust-lang#51279. Attributes on generic parameters are not expanded, meaning `#[cfg]`, `#[cfg_attr]` and attribute proc macros are entirely ignored on them. This PR makes using the first two attributes an error, because if they are correctly expanded will affect the AST and change code behavior. I'm beta-nominating this, because generic parameter attributes are stabilizing in 1.27, and if we did not reserve their usage, we may never be able to repurpose the meaning of these attributes in the Rust 2015 edition.
Rollup of 9 pull requests Successful merges: - #51186 (Remove two redundant .nll.stderr files) - #51283 (Deny #[cfg] and #[cfg_attr] on generic parameters.) - #51368 (Fix the use of closures within #[panic_implementation]) - #51380 (Remove dependency on fmt_macros from typeck) - #51389 (rustdoc: Fix missing stability and src links for inlined external macros) - #51399 (NLL performance boost) - #51407 (Update RLS and Rustfmt) - #51417 (Revert #49719) - #51420 (Tries to address the recent network issues) Failed merges:
Sigh, I thought I asked @abonander to test at least some of this stuff in one of his recent macro expansion PRs to make sure it produces an error. |
Support `cfg` and `cfg_attr` on generic parameters `cfg` attributes are supported in all other positions where attributes are accepted at all. They were previously prohibited in rust-lang#51283 because they weren't implemented correctly before that and were simply ignored.
Support `cfg` and `cfg_attr` on generic parameters `cfg` attributes are supported in all other positions where attributes are accepted at all. They were previously prohibited in rust-lang#51283 because they weren't implemented correctly before that and were simply ignored.
Fix #51279.
Attributes on generic parameters are not expanded, meaning
#[cfg]
,#[cfg_attr]
and attribute proc macros are entirely ignored on them.This PR makes using the first two attributes an error, because if they are correctly expanded will affect the AST and change code behavior.
I'm beta-nominating this, because generic parameter attributes are stabilizing in 1.27, and if we did not reserve their usage, we may never be able to repurpose the meaning of these attributes in the Rust 2015 edition.