about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src/llvm_util.rs
diff options
context:
space:
mode:
authorCaleb Zulawski <caleb.zulawski@gmail.com>2024-08-06 00:35:32 -0400
committerCaleb Zulawski <caleb.zulawski@gmail.com>2024-08-07 00:45:00 -0400
commit8818c9552821721e4be5c19832b4e3ac64090feb (patch)
tree709edffd8770e88eb3762431b1c53649fc0e691d /compiler/rustc_codegen_llvm/src/llvm_util.rs
parent0b98a0c72769c2549827ec2320beb5478ca3c335 (diff)
downloadrust-8818c9552821721e4be5c19832b4e3ac64090feb.tar.gz
rust-8818c9552821721e4be5c19832b4e3ac64090feb.zip
Disallow enabling features without their implied features
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/llvm_util.rs')
-rw-r--r--compiler/rustc_codegen_llvm/src/llvm_util.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/compiler/rustc_codegen_llvm/src/llvm_util.rs b/compiler/rustc_codegen_llvm/src/llvm_util.rs
index 1a80824a3b7..9fd8ca43789 100644
--- a/compiler/rustc_codegen_llvm/src/llvm_util.rs
+++ b/compiler/rustc_codegen_llvm/src/llvm_util.rs
@@ -277,7 +277,7 @@ pub fn check_tied_features(
 /// Used to generate cfg variables and apply features
 /// Must express features in the way Rust understands them
 pub fn target_features(sess: &Session, allow_unstable: bool) -> Vec<Symbol> {
-    let mut features = FxHashSet::default();
+    let mut features = vec![];
 
     // Add base features for the target
     let target_machine = create_informational_target_machine(sess, true);
@@ -313,7 +313,9 @@ pub fn target_features(sess: &Session, allow_unstable: bool) -> Vec<Symbol> {
         if enabled {
             features.extend(sess.target.implied_target_features(std::iter::once(feature)));
         } else {
-            features.remove(&feature);
+            features.retain(|f| {
+                !sess.target.implied_target_features(std::iter::once(*f)).contains(&feature)
+            });
         }
     }