about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src/llvm_util.rs
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2025-01-05 10:34:33 +0100
committerRalf Jung <post@ralfj.de>2025-01-05 10:46:30 +0100
commit2e64b5352be9ec8b2a7b956c2be108394b85f4b0 (patch)
tree1b266e63d96229182c200d2785455ca04a8e5092 /compiler/rustc_codegen_llvm/src/llvm_util.rs
parent43ede97ebf7d874c9076723840c945b051b10ee2 (diff)
downloadrust-2e64b5352be9ec8b2a7b956c2be108394b85f4b0.tar.gz
rust-2e64b5352be9ec8b2a7b956c2be108394b85f4b0.zip
add dedicated type for ABI target feature constraints
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/llvm_util.rs')
-rw-r--r--compiler/rustc_codegen_llvm/src/llvm_util.rs17
1 files changed, 10 insertions, 7 deletions
diff --git a/compiler/rustc_codegen_llvm/src/llvm_util.rs b/compiler/rustc_codegen_llvm/src/llvm_util.rs
index 6ec09b29649..e18e91e569f 100644
--- a/compiler/rustc_codegen_llvm/src/llvm_util.rs
+++ b/compiler/rustc_codegen_llvm/src/llvm_util.rs
@@ -669,9 +669,9 @@ pub(crate) fn global_llvm_features(
 
         // Ensure that all ABI-required features are enabled, and the ABI-forbidden ones
         // are disabled.
-        let (abi_enable, abi_disable) = sess.target.abi_required_features();
-        let abi_enable_set = FxHashSet::from_iter(abi_enable.iter().copied());
-        let abi_disable_set = FxHashSet::from_iter(abi_disable.iter().copied());
+        let abi_feature_constraints = sess.target.abi_required_features();
+        let abi_incompatible_set =
+            FxHashSet::from_iter(abi_feature_constraints.incompatible.iter().copied());
 
         // Compute implied features
         let mut all_rust_features = vec![];
@@ -745,7 +745,7 @@ pub(crate) fn global_llvm_features(
 
                 // Ensure that the features we enable/disable are compatible with the ABI.
                 if enable {
-                    if abi_disable_set.contains(feature) {
+                    if abi_incompatible_set.contains(feature) {
                         sess.dcx().emit_warn(ForbiddenCTargetFeature {
                             feature,
                             enabled: "enabled",
@@ -755,8 +755,7 @@ pub(crate) fn global_llvm_features(
                 } else {
                     // FIXME: we have to request implied features here since
                     // negative features do not handle implied features above.
-                    #[allow(rustc::potential_query_instability)] // order does not matter
-                    for &required in abi_enable_set.iter() {
+                    for &required in abi_feature_constraints.required.iter() {
                         let implied =
                             sess.target.implied_target_features(std::iter::once(required));
                         if implied.contains(feature) {
@@ -783,7 +782,11 @@ pub(crate) fn global_llvm_features(
         // still override it... that's unsound, but more compatible with past behavior.
         all_rust_features.splice(
             0..0,
-            abi_enable.iter().map(|&f| (true, f)).chain(abi_disable.iter().map(|&f| (false, f))),
+            abi_feature_constraints
+                .required
+                .iter()
+                .map(|&f| (true, f))
+                .chain(abi_feature_constraints.incompatible.iter().map(|&f| (false, f))),
         );
 
         // Translate this into LLVM features.