diff --git a/compiler/rustc_codegen_llvm/src/attributes.rs b/compiler/rustc_codegen_llvm/src/attributes.rs index 774ffa8df9342..d4d6a0b731a7b 100644 --- a/compiler/rustc_codegen_llvm/src/attributes.rs +++ b/compiler/rustc_codegen_llvm/src/attributes.rs @@ -384,9 +384,9 @@ fn packed_stack_attr<'ll>( return None; } - // The backchain and softfloat flags can be set via -Ctarget-features=... + // The backchain and softfloat flags can be set via -Ctarget-feature=... // or via #[target_features(enable = ...)] so we have to check both possibilities - let have_backchain = sess.unstable_target_features.contains(&sym::backchain) + let have_backchain = sess.target_features.contains(&sym::backchain) || function_attributes.iter().any(|feature| feature.name == sym::backchain); let have_softfloat = sess.unstable_target_features.contains(&sym::soft_float) || function_attributes.iter().any(|feature| feature.name == sym::soft_float); diff --git a/compiler/rustc_target/src/target_features.rs b/compiler/rustc_target/src/target_features.rs index 8c1ebee8416e5..e3ff6eba6ac98 100644 --- a/compiler/rustc_target/src/target_features.rs +++ b/compiler/rustc_target/src/target_features.rs @@ -904,8 +904,7 @@ static LOONGARCH_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[ #[rustfmt::skip] const IBMZ_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[ // tidy-alphabetical-start - // For "backchain", https://github.com/rust-lang/rust/issues/142412 is a stabilization blocker - ("backchain", Unstable(sym::s390x_target_feature), &[]), + ("backchain", Stable, &[]), ("concurrent-functions", Unstable(sym::s390x_target_feature), &[]), ("deflate-conversion", Unstable(sym::s390x_target_feature), &[]), ("enhanced-sort", Unstable(sym::s390x_target_feature), &[]), diff --git a/tests/codegen-llvm/packedstack.rs b/tests/codegen-llvm/packedstack.rs index 11a01e60f8d40..3d1fd563d8001 100644 --- a/tests/codegen-llvm/packedstack.rs +++ b/tests/codegen-llvm/packedstack.rs @@ -1,7 +1,6 @@ //@ add-minicore //@ compile-flags: -Copt-level=3 --crate-type=lib --target=s390x-unknown-none-softfloat -Zpacked-stack //@ needs-llvm-components: systemz -#![feature(s390x_target_feature)] #![crate_type = "lib"] #![feature(no_core, lang_items)] #![no_core] diff --git a/tests/ui/target-feature/packedstack-combinations.need_softfloat.stderr b/tests/ui/target-feature/packedstack-combinations.need_softfloat.stderr deleted file mode 100644 index 6f4531945ee07..0000000000000 --- a/tests/ui/target-feature/packedstack-combinations.need_softfloat.stderr +++ /dev/null @@ -1,10 +0,0 @@ -warning: unstable feature specified for `-Ctarget-feature`: `backchain` - | - = note: this feature is not stably supported; its behavior can change in the future - -error: packedstack with backchain needs softfloat - | - = note: enabling both `-Zpacked-stack` and the `backchain` target feature is incompatible with the default s390x ABI. Switch to s390x-unknown-none-softfloat if you need both attributes - -error: aborting due to 1 previous error; 1 warning emitted - diff --git a/tests/ui/target-feature/packedstack-combinations.rs b/tests/ui/target-feature/packedstack-combinations.rs index 5dc0f6adf812e..69748761b1beb 100644 --- a/tests/ui/target-feature/packedstack-combinations.rs +++ b/tests/ui/target-feature/packedstack-combinations.rs @@ -24,21 +24,17 @@ //@ [with_softfloat] build-pass //@ [with_softfloat] needs-llvm-components: systemz -#![feature(s390x_target_feature)] #![crate_type = "rlib"] -#![feature(no_core,lang_items)] +#![feature(no_core, lang_items)] #![no_core] extern crate minicore; use minicore::*; #[no_mangle] -#[cfg_attr(backchain_attr,target_feature(enable = "backchain"))] -pub fn test() { -} +#[cfg_attr(backchain_attr, target_feature(enable = "backchain"))] +pub fn test() {} //[wrong_arch]~? ERROR `-Zpacked-stack` is only supported on s390x -//[backchain_cli]~? WARN unstable feature specified for `-Ctarget-feature`: `backchain` //[backchain_cli]~? ERROR `-Zpacked-stack` is incompatible with `backchain` target feature //[backchain_attr]~? ERROR `-Zpacked-stack` is incompatible with `backchain` target feature -//[with_softfloat]~? WARN unstable feature specified for `-Ctarget-feature`: `backchain` diff --git a/tests/ui/target-feature/packedstack-combinations.with_softfloat.stderr b/tests/ui/target-feature/packedstack-combinations.with_softfloat.stderr deleted file mode 100644 index b8c06fc57a448..0000000000000 --- a/tests/ui/target-feature/packedstack-combinations.with_softfloat.stderr +++ /dev/null @@ -1,6 +0,0 @@ -warning: unstable feature specified for `-Ctarget-feature`: `backchain` - | - = note: this feature is not stably supported; its behavior can change in the future - -warning: 1 warning emitted -