diff options
| author | Ralf Jung <post@ralfj.de> | 2024-11-16 10:00:16 +0100 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2024-12-11 22:11:15 +0100 |
| commit | 2d887a5c5ca65287bb40dc5b2d108e2bb2dd6719 (patch) | |
| tree | af562288d549ff410de0ed4bd055d3fb6ba17279 /compiler/rustc_codegen_gcc/src/lib.rs | |
| parent | 1f3bf231e160b9869e2a85260fd6805304bfcee2 (diff) | |
| download | rust-2d887a5c5ca65287bb40dc5b2d108e2bb2dd6719.tar.gz rust-2d887a5c5ca65287bb40dc5b2d108e2bb2dd6719.zip | |
generalize 'forbidden feature' concept so that even (un)stable feature can be invalid to toggle
Also rename some things for extra clarity
Diffstat (limited to 'compiler/rustc_codegen_gcc/src/lib.rs')
| -rw-r--r-- | compiler/rustc_codegen_gcc/src/lib.rs | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/compiler/rustc_codegen_gcc/src/lib.rs b/compiler/rustc_codegen_gcc/src/lib.rs index 452e92bffa2..764e84be1fe 100644 --- a/compiler/rustc_codegen_gcc/src/lib.rs +++ b/compiler/rustc_codegen_gcc/src/lib.rs @@ -260,8 +260,8 @@ impl CodegenBackend for GccCodegenBackend { .join(sess) } - fn target_features(&self, sess: &Session, allow_unstable: bool) -> Vec<Symbol> { - target_features(sess, allow_unstable, &self.target_info) + fn target_features_cfg(&self, sess: &Session, allow_unstable: bool) -> Vec<Symbol> { + target_features_cfg(sess, allow_unstable, &self.target_info) } } @@ -472,7 +472,8 @@ fn to_gcc_opt_level(optlevel: Option<OptLevel>) -> OptimizationLevel { } } -pub fn target_features( +/// Returns the features that should be set in `cfg(target_feature)`. +fn target_features_cfg( sess: &Session, allow_unstable: bool, target_info: &LockedTargetInfo, @@ -481,9 +482,9 @@ pub fn target_features( sess.target .rust_target_features() .iter() - .filter(|(_, gate, _)| gate.is_supported()) + .filter(|(_, gate, _)| gate.in_cfg()) .filter_map(|&(feature, gate, _)| { - if sess.is_nightly_build() || allow_unstable || gate.is_stable() { + if sess.is_nightly_build() || allow_unstable || gate.requires_nightly().is_none() { Some(feature) } else { None |
