From 180dde2e3c237cebaadf7333dfc83ebc15c55e27 Mon Sep 17 00:00:00 2001 From: fo4025 Date: Sat, 18 Jul 2026 22:27:46 +0800 Subject: [PATCH] Add nan2008 target feature for MIPS Allow enabling the LLVM `nan2008` subtarget feature (IEEE 754-2008 NaN encoding) via `-Ctarget-feature` and `#[target_feature]`, gated behind the existing unstable `mips_target_feature` feature gate. This makes it possible to link against MIPS libraries built with GCC's `-mnan=2008`. --- compiler/rustc_target/src/target_features.rs | 1 + tests/ui/check-cfg/target_feature.stderr | 1 + 2 files changed, 2 insertions(+) diff --git a/compiler/rustc_target/src/target_features.rs b/compiler/rustc_target/src/target_features.rs index fc25849b2d602..d7410074b0da8 100644 --- a/compiler/rustc_target/src/target_features.rs +++ b/compiler/rustc_target/src/target_features.rs @@ -606,6 +606,7 @@ const MIPS_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[ // tidy-alphabetical-start ("fp64", Unstable(sym::mips_target_feature), &[]), ("msa", Unstable(sym::mips_target_feature), &[]), + ("nan2008", Unstable(sym::mips_target_feature), &[]), ("virt", Unstable(sym::mips_target_feature), &[]), // tidy-alphabetical-end ]; diff --git a/tests/ui/check-cfg/target_feature.stderr b/tests/ui/check-cfg/target_feature.stderr index eca0813e6a286..7031f2875be69 100644 --- a/tests/ui/check-cfg/target_feature.stderr +++ b/tests/ui/check-cfg/target_feature.stderr @@ -225,6 +225,7 @@ LL | cfg!(target_feature = "_UNEXPECTED_VALUE"); `mutable-globals` `mve` `mve.fp` +`nan2008` `neon` `nnp-assist` `nontrapping-fptoint`