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-02 00:20:49 -0400
committerCaleb Zulawski <caleb.zulawski@gmail.com>2024-08-07 00:41:48 -0400
commitfbd618d4aa8f3a6c998b81aa83a543d4c09d9bb3 (patch)
tree862c48d9ba71d61315799d32f844989c22ff22ea /compiler/rustc_codegen_llvm/src/llvm_util.rs
parent3c48f6548bce89b459952f8d7ca077cfa99159aa (diff)
downloadrust-fbd618d4aa8f3a6c998b81aa83a543d4c09d9bb3.tar.gz
rust-fbd618d4aa8f3a6c998b81aa83a543d4c09d9bb3.zip
Refactor and fill out target feature lists
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/llvm_util.rs')
-rw-r--r--compiler/rustc_codegen_llvm/src/llvm_util.rs28
1 files changed, 15 insertions, 13 deletions
diff --git a/compiler/rustc_codegen_llvm/src/llvm_util.rs b/compiler/rustc_codegen_llvm/src/llvm_util.rs
index dc21b92a95f..c70f6dd8180 100644
--- a/compiler/rustc_codegen_llvm/src/llvm_util.rs
+++ b/compiler/rustc_codegen_llvm/src/llvm_util.rs
@@ -312,7 +312,7 @@ pub fn target_features(sess: &Session, allow_unstable: bool) -> Vec<Symbol> {
     sess.target
         .supported_target_features()
         .iter()
-        .filter_map(|&(feature, gate)| {
+        .filter_map(|&(feature, gate, _)| {
             if sess.is_nightly_build() || allow_unstable || gate.is_stable() {
                 Some(feature)
             } else {
@@ -386,7 +386,7 @@ fn print_target_features(out: &mut String, sess: &Session, tm: &llvm::TargetMach
         .target
         .supported_target_features()
         .iter()
-        .map(|(feature, _gate)| {
+        .map(|(feature, _gate, _implied)| {
             // LLVM asserts that these are sorted. LLVM and Rust both use byte comparison for these strings.
             let llvm_feature = to_llvm_features(sess, *feature).llvm_feature_name;
             let desc =
@@ -571,17 +571,19 @@ pub(crate) fn global_llvm_features(sess: &Session, diagnostics: bool) -> Vec<Str
             let feature = backend_feature_name(sess, s)?;
             // Warn against use of LLVM specific feature names and unstable features on the CLI.
             if diagnostics {
-                let feature_state = supported_features.iter().find(|&&(v, _)| v == feature);
+                let feature_state = supported_features.iter().find(|&&(v, _, _)| v == feature);
                 if feature_state.is_none() {
-                    let rust_feature = supported_features.iter().find_map(|&(rust_feature, _)| {
-                        let llvm_features = to_llvm_features(sess, rust_feature);
-                        if llvm_features.contains(feature) && !llvm_features.contains(rust_feature)
-                        {
-                            Some(rust_feature)
-                        } else {
-                            None
-                        }
-                    });
+                    let rust_feature =
+                        supported_features.iter().find_map(|&(rust_feature, _, _)| {
+                            let llvm_features = to_llvm_features(sess, rust_feature);
+                            if llvm_features.contains(feature)
+                                && !llvm_features.contains(rust_feature)
+                            {
+                                Some(rust_feature)
+                            } else {
+                                None
+                            }
+                        });
                     let unknown_feature = if let Some(rust_feature) = rust_feature {
                         UnknownCTargetFeature {
                             feature,
@@ -592,7 +594,7 @@ pub(crate) fn global_llvm_features(sess: &Session, diagnostics: bool) -> Vec<Str
                     };
                     sess.dcx().emit_warn(unknown_feature);
                 } else if feature_state
-                    .is_some_and(|(_name, feature_gate)| !feature_gate.is_stable())
+                    .is_some_and(|(_name, feature_gate, _implied)| !feature_gate.is_stable())
                 {
                     // An unstable feature. Warn about using it.
                     sess.dcx().emit_warn(UnstableCTargetFeature { feature });