-
-
Notifications
You must be signed in to change notification settings - Fork 15k
Feature gate for unstable target_feature values not being checked on nightly #76842
Copy link
Copy link
Open
Labels
A-stabilityArea: `#[stable]`, `#[unstable]` etc.Area: `#[stable]`, `#[unstable]` etc.C-bugCategory: This is a bug.Category: This is a bug.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.requires-nightlyThis issue requires a nightly compiler in some way. When possible, use a F-* label instead.This issue requires a nightly compiler in some way. When possible, use a F-* label instead.
Metadata
Metadata
Assignees
Labels
A-stabilityArea: `#[stable]`, `#[unstable]` etc.Area: `#[stable]`, `#[unstable]` etc.C-bugCategory: This is a bug.Category: This is a bug.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.requires-nightlyThis issue requires a nightly compiler in some way. When possible, use a F-* label instead.This issue requires a nightly compiler in some way. When possible, use a F-* label instead.
Type
Fields
Give feedbackNo fields configured for issues without a type.
I tried this code: playpen
I expected to see this happen:
This code uses a feature-gated
cfg(, without enabling the feature. I would expect this to produce a build warning about using an unstable cfg gate, and produce no build error on all channels.(
target_feature="mmx"is currently gated behindmmx_target_featureas far as I can tell)rust/compiler/rustc_codegen_llvm/src/llvm_util.rs
Line 206 in 7bdb5de
Instead, this happened:
On stable, the gate was ignored as expected, but on the nightly channel the cfg check passed, causing the
compile_fail!to be included in the source. The lack of a feature gate enablingmmx_target_featurewas ignored, only considering the current release channel.I believe this is occurring due to the feature gate logic for the
target_featureconfig flag not being checked within the compiler. This mismatch lead me to believe that an unstabletarget_featureflag was actually stable, and write code using it, before realizing it won't function outside of the nightly channel.Meta
rustc --version --verbose:stable:
nightly:
(this also occurs on rust-playpen at time of filing: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=4c58960ac6fc536a2da930d6c0b3d8e9)