x86 soft-float feature: mark it as forbidden rather than unstable

This commit is contained in:
Ralf Jung 2026-01-18 17:14:52 +01:00
parent ba2a7d3374
commit fdc7cfde55
5 changed files with 24 additions and 7 deletions

View file

@ -466,9 +466,7 @@ static X86_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[
("sha512", Stable, &["avx2"]),
("sm3", Stable, &["avx"]),
("sm4", Stable, &["avx2"]),
// This cannot actually be toggled, the ABI always fixes it, so it'd make little sense to
// stabilize. It must be in this list for the ABI check to be able to use it.
("soft-float", Stability::Unstable(sym::x87_target_feature), &[]),
("soft-float", Stability::Forbidden { reason: "use a soft-float target instead" }, &[]),
("sse", Stable, &[]),
("sse2", Stable, &["sse"]),
("sse3", Stable, &["sse2"]),

View file

@ -1,4 +1,4 @@
error: target feature `soft-float` cannot be enabled with `#[target_feature]`: this feature is incompatible with the target ABI
error: target feature `soft-float` cannot be enabled with `#[target_feature]`: use a soft-float target instead
--> $DIR/abi-incompatible-target-feature-attribute.rs:17:32
|
LL | #[cfg_attr(x86, target_feature(enable = "soft-float"))] #[cfg_attr(riscv, target_feature(enable = "d"))]

View file

@ -19,4 +19,5 @@ extern crate minicore;
use minicore::*;
//~? WARN must be disabled to ensure that the ABI of the current target can be implemented correctly
//~? WARN unstable feature specified for `-Ctarget-feature`
//[riscv]~? WARN unstable feature specified for `-Ctarget-feature`
//[x86]~? WARN use a soft-float target instead

View file

@ -1,6 +1,7 @@
warning: unstable feature specified for `-Ctarget-feature`: `soft-float`
warning: target feature `soft-float` cannot be enabled with `-Ctarget-feature`: use a soft-float target instead
|
= note: this feature is not stably supported; its behavior can change in the future
= note: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #116344 <https://github.com/rust-lang/rust/issues/116344>
warning: target feature `soft-float` must be disabled to ensure that the ABI of the current target can be implemented correctly
|

View file

@ -0,0 +1,17 @@
//! The soft-float target feature is *not* exposed as `cfg` on x86.
//@ revisions: soft hard
//@[hard] compile-flags: --target=x86_64-unknown-linux-gnu --crate-type=lib
//@[hard] needs-llvm-components: x86
//@[soft] compile-flags: --target=x86_64-unknown-none --crate-type=lib
//@[soft] needs-llvm-components: x86
//@ check-pass
//@ ignore-backends: gcc
//@ add-minicore
#![feature(no_core)]
#![no_core]
#![allow(unexpected_cfgs)]
// The compile_error macro does not exist, so if the `cfg` evaluates to `true` this
// complains about the missing macro rather than showing the error... but that's good enough.
#[cfg(target_feature = "soft-float")]
compile_error!("the soft-float feature should NOT be exposed in `cfg`");