Feature gate for unstable target_feature values not being checked on nightly #76842
Labels
A-stability
Area: `#[stable]`, `#[unstable]` etc.
C-bug
Category: This is a bug.
requires-nightly
This issue requires a nightly compiler in some way.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
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_feature
as 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_feature
was ignored, only considering the current release channel.I believe this is occurring due to the feature gate logic for the
target_feature
config flag not being checked within the compiler. This mismatch lead me to believe that an unstabletarget_feature
flag 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)
The text was updated successfully, but these errors were encountered: