Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions compiler/rustc_target/src/target_features.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"]),
Expand Down
Original file line number Diff line number Diff line change
@@ -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"))]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
@@ -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
|
Expand Down
17 changes: 17 additions & 0 deletions tests/ui/target-feature/x86-soft-float-cfg.rs
Original file line number Diff line number Diff line change
@@ -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`");
Loading