diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2023-11-14 21:50:38 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-11-14 21:50:38 +0100 |
| commit | 7435887d6ca027c031a40df8857fb625c09faa05 (patch) | |
| tree | f6bcbc74d3d2702308cda198612eb2e0b865641a /compiler/rustc_codegen_llvm/src | |
| parent | d2cdf6c479c6d86d901a860de08875718ecfd7a7 (diff) | |
| parent | 6dd2ea0f35e0e30bf52b481971d039a18f96eef1 (diff) | |
| download | rust-7435887d6ca027c031a40df8857fb625c09faa05.tar.gz rust-7435887d6ca027c031a40df8857fb625c09faa05.zip | |
Rollup merge of #117834 - RalfJung:target-feature-stability, r=b-naber
target_feature: make it more clear what that 'Option' means Reading those tables in compiler/rustc_codegen_ssa/src/target_features.rs, it's not immediately clear that `None` means "stable". Let's use an enum with appropriately named variants to make that more obvious.
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/llvm_util.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/compiler/rustc_codegen_llvm/src/llvm_util.rs b/compiler/rustc_codegen_llvm/src/llvm_util.rs index cc4ccaf19c2..c86bf81fc13 100644 --- a/compiler/rustc_codegen_llvm/src/llvm_util.rs +++ b/compiler/rustc_codegen_llvm/src/llvm_util.rs @@ -293,7 +293,7 @@ pub fn target_features(sess: &Session, allow_unstable: bool) -> Vec<Symbol> { supported_target_features(sess) .iter() .filter_map(|&(feature, gate)| { - if sess.is_nightly_build() || allow_unstable || gate.is_none() { + if sess.is_nightly_build() || allow_unstable || gate.is_stable() { Some(feature) } else { None @@ -554,7 +554,8 @@ pub(crate) fn global_llvm_features(sess: &Session, diagnostics: bool) -> Vec<Str UnknownCTargetFeature { feature, rust_feature: PossibleFeature::None } }; sess.emit_warning(unknown_feature); - } else if feature_state.is_some_and(|(_name, feature_gate)| feature_gate.is_some()) + } else if feature_state + .is_some_and(|(_name, feature_gate)| !feature_gate.is_stable()) { // An unstable feature. Warn about using it. sess.emit_warning(UnstableCTargetFeature { feature }); |
