From 2f2d3c887063d41cf361f58b34c0e0b48c83398f Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Mon, 28 Apr 2025 15:17:33 +0200 Subject: forbidden target feature tests: consolidate multiple tests in a single one with revisions --- ...dden-hardfloat-target-feature-flag-disable-implied.rs | 15 --------------- ...-hardfloat-target-feature-flag-disable-implied.stderr | 7 ------- ...rbidden-hardfloat-target-feature-flag-disable-neon.rs | 13 ------------- ...den-hardfloat-target-feature-flag-disable-neon.stderr | 7 ------- ...-hardfloat-target-feature-flag-disable.aarch64.stderr | 7 +++++++ .../forbidden-hardfloat-target-feature-flag-disable.rs | 16 +++++++++++----- ...orbidden-hardfloat-target-feature-flag-disable.stderr | 11 ----------- ...dfloat-target-feature-flag-disable.x86-implied.stderr | 7 +++++++ ...dden-hardfloat-target-feature-flag-disable.x86.stderr | 11 +++++++++++ 9 files changed, 36 insertions(+), 58 deletions(-) delete mode 100644 tests/ui/target-feature/forbidden-hardfloat-target-feature-flag-disable-implied.rs delete mode 100644 tests/ui/target-feature/forbidden-hardfloat-target-feature-flag-disable-implied.stderr delete mode 100644 tests/ui/target-feature/forbidden-hardfloat-target-feature-flag-disable-neon.rs delete mode 100644 tests/ui/target-feature/forbidden-hardfloat-target-feature-flag-disable-neon.stderr create mode 100644 tests/ui/target-feature/forbidden-hardfloat-target-feature-flag-disable.aarch64.stderr delete mode 100644 tests/ui/target-feature/forbidden-hardfloat-target-feature-flag-disable.stderr create mode 100644 tests/ui/target-feature/forbidden-hardfloat-target-feature-flag-disable.x86-implied.stderr create mode 100644 tests/ui/target-feature/forbidden-hardfloat-target-feature-flag-disable.x86.stderr (limited to 'tests/ui') diff --git a/tests/ui/target-feature/forbidden-hardfloat-target-feature-flag-disable-implied.rs b/tests/ui/target-feature/forbidden-hardfloat-target-feature-flag-disable-implied.rs deleted file mode 100644 index 12e7e3bc45b..00000000000 --- a/tests/ui/target-feature/forbidden-hardfloat-target-feature-flag-disable-implied.rs +++ /dev/null @@ -1,15 +0,0 @@ -//! Ensure that if disabling a target feature implies disabling an ABI-required target feature, -//! we complain. -//@ compile-flags: --target=x86_64-unknown-linux-gnu --crate-type=lib -//@ needs-llvm-components: x86 -//@ compile-flags: -Ctarget-feature=-sse -// For now this is just a warning. -//@ build-pass - -#![feature(no_core, lang_items)] -#![no_core] - -#[lang = "sized"] -pub trait Sized {} - -//~? WARN target feature `sse2` must be enabled to ensure that the ABI of the current target can be implemented correctly diff --git a/tests/ui/target-feature/forbidden-hardfloat-target-feature-flag-disable-implied.stderr b/tests/ui/target-feature/forbidden-hardfloat-target-feature-flag-disable-implied.stderr deleted file mode 100644 index 7ec8b04cfce..00000000000 --- a/tests/ui/target-feature/forbidden-hardfloat-target-feature-flag-disable-implied.stderr +++ /dev/null @@ -1,7 +0,0 @@ -warning: target feature `sse2` must be enabled to ensure that the ABI of the current target can be implemented correctly - | - = 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 - -warning: 1 warning emitted - diff --git a/tests/ui/target-feature/forbidden-hardfloat-target-feature-flag-disable-neon.rs b/tests/ui/target-feature/forbidden-hardfloat-target-feature-flag-disable-neon.rs deleted file mode 100644 index 33e4f12694f..00000000000 --- a/tests/ui/target-feature/forbidden-hardfloat-target-feature-flag-disable-neon.rs +++ /dev/null @@ -1,13 +0,0 @@ -//@ compile-flags: --target=aarch64-unknown-linux-gnu --crate-type=lib -//@ needs-llvm-components: aarch64 -//@ compile-flags: -Ctarget-feature=-neon -// For now this is just a warning. -//@ build-pass - -#![feature(no_core, lang_items)] -#![no_core] - -#[lang = "sized"] -pub trait Sized {} - -//~? WARN target feature `neon` must be enabled to ensure that the ABI of the current target can be implemented correctly diff --git a/tests/ui/target-feature/forbidden-hardfloat-target-feature-flag-disable-neon.stderr b/tests/ui/target-feature/forbidden-hardfloat-target-feature-flag-disable-neon.stderr deleted file mode 100644 index b1186d5d5dc..00000000000 --- a/tests/ui/target-feature/forbidden-hardfloat-target-feature-flag-disable-neon.stderr +++ /dev/null @@ -1,7 +0,0 @@ -warning: target feature `neon` must be enabled to ensure that the ABI of the current target can be implemented correctly - | - = 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 - -warning: 1 warning emitted - diff --git a/tests/ui/target-feature/forbidden-hardfloat-target-feature-flag-disable.aarch64.stderr b/tests/ui/target-feature/forbidden-hardfloat-target-feature-flag-disable.aarch64.stderr new file mode 100644 index 00000000000..b1186d5d5dc --- /dev/null +++ b/tests/ui/target-feature/forbidden-hardfloat-target-feature-flag-disable.aarch64.stderr @@ -0,0 +1,7 @@ +warning: target feature `neon` must be enabled to ensure that the ABI of the current target can be implemented correctly + | + = 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 + +warning: 1 warning emitted + diff --git a/tests/ui/target-feature/forbidden-hardfloat-target-feature-flag-disable.rs b/tests/ui/target-feature/forbidden-hardfloat-target-feature-flag-disable.rs index e1bd25ffad1..e0d095844fb 100644 --- a/tests/ui/target-feature/forbidden-hardfloat-target-feature-flag-disable.rs +++ b/tests/ui/target-feature/forbidden-hardfloat-target-feature-flag-disable.rs @@ -1,7 +1,13 @@ //! Ensure ABI-required features cannot be disabled via `-Ctarget-feature`. -//@ compile-flags: --target=x86_64-unknown-linux-gnu --crate-type=lib -//@ needs-llvm-components: x86 -//@ compile-flags: -Ctarget-feature=-x87 +//! Also covers the case of a feature indirectly disabling another via feature implications. +//@ compile-flags: --crate-type=lib +//@ revisions: x86 x86-implied aarch64 +//@[x86] compile-flags: --target=x86_64-unknown-linux-gnu -Ctarget-feature=-x87 +//@[x86] needs-llvm-components: x86 +//@[x86-implied] compile-flags: --target=x86_64-unknown-linux-gnu -Ctarget-feature=-sse +//@[x86-implied] needs-llvm-components: x86 +//@[aarch64] compile-flags: --target=aarch64-unknown-linux-gnu -Ctarget-feature=-neon +//@[aarch64] needs-llvm-components: aarch64 // For now this is just a warning. //@ build-pass @@ -11,5 +17,5 @@ #[lang = "sized"] pub trait Sized {} -//~? WARN target feature `x87` must be enabled to ensure that the ABI of the current target can be implemented correctly -//~? WARN unstable feature specified for `-Ctarget-feature`: `x87` +//~? WARN must be enabled to ensure that the ABI of the current target can be implemented correctly +//[x86]~? WARN unstable feature specified for `-Ctarget-feature` diff --git a/tests/ui/target-feature/forbidden-hardfloat-target-feature-flag-disable.stderr b/tests/ui/target-feature/forbidden-hardfloat-target-feature-flag-disable.stderr deleted file mode 100644 index 02398d27501..00000000000 --- a/tests/ui/target-feature/forbidden-hardfloat-target-feature-flag-disable.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: target feature `x87` must be enabled to ensure that the ABI of the current target can be implemented correctly - | - = 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 - -warning: unstable feature specified for `-Ctarget-feature`: `x87` - | - = note: this feature is not stably supported; its behavior can change in the future - -warning: 2 warnings emitted - diff --git a/tests/ui/target-feature/forbidden-hardfloat-target-feature-flag-disable.x86-implied.stderr b/tests/ui/target-feature/forbidden-hardfloat-target-feature-flag-disable.x86-implied.stderr new file mode 100644 index 00000000000..7ec8b04cfce --- /dev/null +++ b/tests/ui/target-feature/forbidden-hardfloat-target-feature-flag-disable.x86-implied.stderr @@ -0,0 +1,7 @@ +warning: target feature `sse2` must be enabled to ensure that the ABI of the current target can be implemented correctly + | + = 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 + +warning: 1 warning emitted + diff --git a/tests/ui/target-feature/forbidden-hardfloat-target-feature-flag-disable.x86.stderr b/tests/ui/target-feature/forbidden-hardfloat-target-feature-flag-disable.x86.stderr new file mode 100644 index 00000000000..02398d27501 --- /dev/null +++ b/tests/ui/target-feature/forbidden-hardfloat-target-feature-flag-disable.x86.stderr @@ -0,0 +1,11 @@ +warning: target feature `x87` must be enabled to ensure that the ABI of the current target can be implemented correctly + | + = 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 + +warning: unstable feature specified for `-Ctarget-feature`: `x87` + | + = note: this feature is not stably supported; its behavior can change in the future + +warning: 2 warnings emitted + -- cgit 1.4.1-3-g733a5 From 7a2d51dc29c0184bc97a373231634e07d6f1f0f9 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Mon, 28 Apr 2025 15:22:14 +0200 Subject: give the abi-relevant target feature tests better names --- .../abi-incompatible-target-feature-attribute.rs | 12 ++++++++++++ ...abi-incompatible-target-feature-attribute.stderr | 8 ++++++++ .../abi-incompatible-target-feature-flag-enable.rs | 15 +++++++++++++++ ...i-incompatible-target-feature-flag-enable.stderr | 11 +++++++++++ .../abi-irrelevant-target-feature-flag-disable.rs | 14 ++++++++++++++ ...bi-irrelevant-target-feature-flag-disable.stderr | 6 ++++++ .../abi-required-target-feature-attribute.rs | 13 +++++++++++++ ...uired-target-feature-flag-disable.aarch64.stderr | 7 +++++++ .../abi-required-target-feature-flag-disable.rs | 21 +++++++++++++++++++++ ...d-target-feature-flag-disable.x86-implied.stderr | 7 +++++++ ...-required-target-feature-flag-disable.x86.stderr | 11 +++++++++++ .../allowed-softfloat-target-feature-attribute.rs | 11 ----------- ...allowed-softfloat-target-feature-flag-disable.rs | 11 ----------- ...wed-softfloat-target-feature-flag-disable.stderr | 6 ------ .../forbidden-hardfloat-target-feature-attribute.rs | 12 ------------ ...bidden-hardfloat-target-feature-attribute.stderr | 8 -------- ...float-target-feature-flag-disable.aarch64.stderr | 7 ------- ...rbidden-hardfloat-target-feature-flag-disable.rs | 21 --------------------- ...t-target-feature-flag-disable.x86-implied.stderr | 7 ------- ...hardfloat-target-feature-flag-disable.x86.stderr | 11 ----------- .../forbidden-hardfloat-target-feature-flag.rs | 15 --------------- .../forbidden-hardfloat-target-feature-flag.stderr | 11 ----------- 22 files changed, 125 insertions(+), 120 deletions(-) create mode 100644 tests/ui/target-feature/abi-incompatible-target-feature-attribute.rs create mode 100644 tests/ui/target-feature/abi-incompatible-target-feature-attribute.stderr create mode 100644 tests/ui/target-feature/abi-incompatible-target-feature-flag-enable.rs create mode 100644 tests/ui/target-feature/abi-incompatible-target-feature-flag-enable.stderr create mode 100644 tests/ui/target-feature/abi-irrelevant-target-feature-flag-disable.rs create mode 100644 tests/ui/target-feature/abi-irrelevant-target-feature-flag-disable.stderr create mode 100644 tests/ui/target-feature/abi-required-target-feature-attribute.rs create mode 100644 tests/ui/target-feature/abi-required-target-feature-flag-disable.aarch64.stderr create mode 100644 tests/ui/target-feature/abi-required-target-feature-flag-disable.rs create mode 100644 tests/ui/target-feature/abi-required-target-feature-flag-disable.x86-implied.stderr create mode 100644 tests/ui/target-feature/abi-required-target-feature-flag-disable.x86.stderr delete mode 100644 tests/ui/target-feature/allowed-softfloat-target-feature-attribute.rs delete mode 100644 tests/ui/target-feature/allowed-softfloat-target-feature-flag-disable.rs delete mode 100644 tests/ui/target-feature/allowed-softfloat-target-feature-flag-disable.stderr delete mode 100644 tests/ui/target-feature/forbidden-hardfloat-target-feature-attribute.rs delete mode 100644 tests/ui/target-feature/forbidden-hardfloat-target-feature-attribute.stderr delete mode 100644 tests/ui/target-feature/forbidden-hardfloat-target-feature-flag-disable.aarch64.stderr delete mode 100644 tests/ui/target-feature/forbidden-hardfloat-target-feature-flag-disable.rs delete mode 100644 tests/ui/target-feature/forbidden-hardfloat-target-feature-flag-disable.x86-implied.stderr delete mode 100644 tests/ui/target-feature/forbidden-hardfloat-target-feature-flag-disable.x86.stderr delete mode 100644 tests/ui/target-feature/forbidden-hardfloat-target-feature-flag.rs delete mode 100644 tests/ui/target-feature/forbidden-hardfloat-target-feature-flag.stderr (limited to 'tests/ui') diff --git a/tests/ui/target-feature/abi-incompatible-target-feature-attribute.rs b/tests/ui/target-feature/abi-incompatible-target-feature-attribute.rs new file mode 100644 index 00000000000..215e64979f7 --- /dev/null +++ b/tests/ui/target-feature/abi-incompatible-target-feature-attribute.rs @@ -0,0 +1,12 @@ +//! Ensure ABI-incompatible features cannot be enabled via `#[target_feature]`. +//@ compile-flags: --target=riscv32e-unknown-none-elf --crate-type=lib +//@ needs-llvm-components: riscv +#![feature(no_core, lang_items, riscv_target_feature)] +#![no_core] + +#[lang = "sized"] +pub trait Sized {} + +#[target_feature(enable = "d")] +//~^ERROR: cannot be enabled with +pub unsafe fn my_fun() {} diff --git a/tests/ui/target-feature/abi-incompatible-target-feature-attribute.stderr b/tests/ui/target-feature/abi-incompatible-target-feature-attribute.stderr new file mode 100644 index 00000000000..baa8551b17a --- /dev/null +++ b/tests/ui/target-feature/abi-incompatible-target-feature-attribute.stderr @@ -0,0 +1,8 @@ +error: target feature `d` cannot be enabled with `#[target_feature]`: this feature is incompatible with the target ABI + --> $DIR/abi-incompatible-target-feature-attribute.rs:10:18 + | +LL | #[target_feature(enable = "d")] + | ^^^^^^^^^^^^ + +error: aborting due to 1 previous error + diff --git a/tests/ui/target-feature/abi-incompatible-target-feature-flag-enable.rs b/tests/ui/target-feature/abi-incompatible-target-feature-flag-enable.rs new file mode 100644 index 00000000000..4ccc6e0e941 --- /dev/null +++ b/tests/ui/target-feature/abi-incompatible-target-feature-flag-enable.rs @@ -0,0 +1,15 @@ +//! Ensure ABI-incompatible features cannot be enabled via `-Ctarget-feature`. +//@ compile-flags: --target=x86_64-unknown-linux-gnu --crate-type=lib +//@ needs-llvm-components: x86 +//@ compile-flags: -Ctarget-feature=+soft-float +// For now this is just a warning. +//@ build-pass + +#![feature(no_core, lang_items, riscv_target_feature)] +#![no_core] + +#[lang = "sized"] +pub trait Sized {} + +//~? WARN target feature `soft-float` must be disabled to ensure that the ABI of the current target can be implemented correctl +//~? WARN unstable feature specified for `-Ctarget-feature`: `soft-float` diff --git a/tests/ui/target-feature/abi-incompatible-target-feature-flag-enable.stderr b/tests/ui/target-feature/abi-incompatible-target-feature-flag-enable.stderr new file mode 100644 index 00000000000..e49672f33b9 --- /dev/null +++ b/tests/ui/target-feature/abi-incompatible-target-feature-flag-enable.stderr @@ -0,0 +1,11 @@ +warning: target feature `soft-float` must be disabled to ensure that the ABI of the current target can be implemented correctly + | + = 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 + +warning: unstable feature specified for `-Ctarget-feature`: `soft-float` + | + = note: this feature is not stably supported; its behavior can change in the future + +warning: 2 warnings emitted + diff --git a/tests/ui/target-feature/abi-irrelevant-target-feature-flag-disable.rs b/tests/ui/target-feature/abi-irrelevant-target-feature-flag-disable.rs new file mode 100644 index 00000000000..0013d033b9c --- /dev/null +++ b/tests/ui/target-feature/abi-irrelevant-target-feature-flag-disable.rs @@ -0,0 +1,14 @@ +//! `x87` is a required target feature on some x86 targets, but not on this one as this one +//! uses soft-floats. So ensure disabling the target feature here (which is a NOP) does +//! not trigger a warning. +//@ compile-flags: --target=x86_64-unknown-none --crate-type=lib +//@ needs-llvm-components: x86 +//@ compile-flags: -Ctarget-feature=-x87 +//@ build-pass +#![feature(no_core, lang_items)] +#![no_core] + +#[lang = "sized"] +pub trait Sized {} + +//~? WARN unstable feature specified for `-Ctarget-feature`: `x87` diff --git a/tests/ui/target-feature/abi-irrelevant-target-feature-flag-disable.stderr b/tests/ui/target-feature/abi-irrelevant-target-feature-flag-disable.stderr new file mode 100644 index 00000000000..309b64afd92 --- /dev/null +++ b/tests/ui/target-feature/abi-irrelevant-target-feature-flag-disable.stderr @@ -0,0 +1,6 @@ +warning: unstable feature specified for `-Ctarget-feature`: `x87` + | + = note: this feature is not stably supported; its behavior can change in the future + +warning: 1 warning emitted + diff --git a/tests/ui/target-feature/abi-required-target-feature-attribute.rs b/tests/ui/target-feature/abi-required-target-feature-attribute.rs new file mode 100644 index 00000000000..95723c57f94 --- /dev/null +++ b/tests/ui/target-feature/abi-required-target-feature-attribute.rs @@ -0,0 +1,13 @@ +//! Enabling a target feature that is anyway required changes nothing, so this is allowed +//! for `#[target_feature]`. +//@ compile-flags: --target=x86_64-unknown-none --crate-type=lib +//@ needs-llvm-components: x86 +//@ build-pass +#![feature(no_core, lang_items, x87_target_feature)] +#![no_core] + +#[lang = "sized"] +pub trait Sized {} + +#[target_feature(enable = "x87")] +pub unsafe fn my_fun() {} diff --git a/tests/ui/target-feature/abi-required-target-feature-flag-disable.aarch64.stderr b/tests/ui/target-feature/abi-required-target-feature-flag-disable.aarch64.stderr new file mode 100644 index 00000000000..b1186d5d5dc --- /dev/null +++ b/tests/ui/target-feature/abi-required-target-feature-flag-disable.aarch64.stderr @@ -0,0 +1,7 @@ +warning: target feature `neon` must be enabled to ensure that the ABI of the current target can be implemented correctly + | + = 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 + +warning: 1 warning emitted + diff --git a/tests/ui/target-feature/abi-required-target-feature-flag-disable.rs b/tests/ui/target-feature/abi-required-target-feature-flag-disable.rs new file mode 100644 index 00000000000..e0d095844fb --- /dev/null +++ b/tests/ui/target-feature/abi-required-target-feature-flag-disable.rs @@ -0,0 +1,21 @@ +//! Ensure ABI-required features cannot be disabled via `-Ctarget-feature`. +//! Also covers the case of a feature indirectly disabling another via feature implications. +//@ compile-flags: --crate-type=lib +//@ revisions: x86 x86-implied aarch64 +//@[x86] compile-flags: --target=x86_64-unknown-linux-gnu -Ctarget-feature=-x87 +//@[x86] needs-llvm-components: x86 +//@[x86-implied] compile-flags: --target=x86_64-unknown-linux-gnu -Ctarget-feature=-sse +//@[x86-implied] needs-llvm-components: x86 +//@[aarch64] compile-flags: --target=aarch64-unknown-linux-gnu -Ctarget-feature=-neon +//@[aarch64] needs-llvm-components: aarch64 +// For now this is just a warning. +//@ build-pass + +#![feature(no_core, lang_items)] +#![no_core] + +#[lang = "sized"] +pub trait Sized {} + +//~? WARN must be enabled to ensure that the ABI of the current target can be implemented correctly +//[x86]~? WARN unstable feature specified for `-Ctarget-feature` diff --git a/tests/ui/target-feature/abi-required-target-feature-flag-disable.x86-implied.stderr b/tests/ui/target-feature/abi-required-target-feature-flag-disable.x86-implied.stderr new file mode 100644 index 00000000000..7ec8b04cfce --- /dev/null +++ b/tests/ui/target-feature/abi-required-target-feature-flag-disable.x86-implied.stderr @@ -0,0 +1,7 @@ +warning: target feature `sse2` must be enabled to ensure that the ABI of the current target can be implemented correctly + | + = 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 + +warning: 1 warning emitted + diff --git a/tests/ui/target-feature/abi-required-target-feature-flag-disable.x86.stderr b/tests/ui/target-feature/abi-required-target-feature-flag-disable.x86.stderr new file mode 100644 index 00000000000..02398d27501 --- /dev/null +++ b/tests/ui/target-feature/abi-required-target-feature-flag-disable.x86.stderr @@ -0,0 +1,11 @@ +warning: target feature `x87` must be enabled to ensure that the ABI of the current target can be implemented correctly + | + = 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 + +warning: unstable feature specified for `-Ctarget-feature`: `x87` + | + = note: this feature is not stably supported; its behavior can change in the future + +warning: 2 warnings emitted + diff --git a/tests/ui/target-feature/allowed-softfloat-target-feature-attribute.rs b/tests/ui/target-feature/allowed-softfloat-target-feature-attribute.rs deleted file mode 100644 index 8b60820cc9b..00000000000 --- a/tests/ui/target-feature/allowed-softfloat-target-feature-attribute.rs +++ /dev/null @@ -1,11 +0,0 @@ -//@ compile-flags: --target=x86_64-unknown-none --crate-type=lib -//@ needs-llvm-components: x86 -//@ build-pass -#![feature(no_core, lang_items, x87_target_feature)] -#![no_core] - -#[lang = "sized"] -pub trait Sized {} - -#[target_feature(enable = "x87")] -pub unsafe fn my_fun() {} diff --git a/tests/ui/target-feature/allowed-softfloat-target-feature-flag-disable.rs b/tests/ui/target-feature/allowed-softfloat-target-feature-flag-disable.rs deleted file mode 100644 index 7368ef120fa..00000000000 --- a/tests/ui/target-feature/allowed-softfloat-target-feature-flag-disable.rs +++ /dev/null @@ -1,11 +0,0 @@ -//@ compile-flags: --target=x86_64-unknown-none --crate-type=lib -//@ needs-llvm-components: x86 -//@ compile-flags: -Ctarget-feature=-x87 -//@ build-pass -#![feature(no_core, lang_items)] -#![no_core] - -#[lang = "sized"] -pub trait Sized {} - -//~? WARN unstable feature specified for `-Ctarget-feature`: `x87` diff --git a/tests/ui/target-feature/allowed-softfloat-target-feature-flag-disable.stderr b/tests/ui/target-feature/allowed-softfloat-target-feature-flag-disable.stderr deleted file mode 100644 index 309b64afd92..00000000000 --- a/tests/ui/target-feature/allowed-softfloat-target-feature-flag-disable.stderr +++ /dev/null @@ -1,6 +0,0 @@ -warning: unstable feature specified for `-Ctarget-feature`: `x87` - | - = note: this feature is not stably supported; its behavior can change in the future - -warning: 1 warning emitted - diff --git a/tests/ui/target-feature/forbidden-hardfloat-target-feature-attribute.rs b/tests/ui/target-feature/forbidden-hardfloat-target-feature-attribute.rs deleted file mode 100644 index 215e64979f7..00000000000 --- a/tests/ui/target-feature/forbidden-hardfloat-target-feature-attribute.rs +++ /dev/null @@ -1,12 +0,0 @@ -//! Ensure ABI-incompatible features cannot be enabled via `#[target_feature]`. -//@ compile-flags: --target=riscv32e-unknown-none-elf --crate-type=lib -//@ needs-llvm-components: riscv -#![feature(no_core, lang_items, riscv_target_feature)] -#![no_core] - -#[lang = "sized"] -pub trait Sized {} - -#[target_feature(enable = "d")] -//~^ERROR: cannot be enabled with -pub unsafe fn my_fun() {} diff --git a/tests/ui/target-feature/forbidden-hardfloat-target-feature-attribute.stderr b/tests/ui/target-feature/forbidden-hardfloat-target-feature-attribute.stderr deleted file mode 100644 index bfe767e5ffb..00000000000 --- a/tests/ui/target-feature/forbidden-hardfloat-target-feature-attribute.stderr +++ /dev/null @@ -1,8 +0,0 @@ -error: target feature `d` cannot be enabled with `#[target_feature]`: this feature is incompatible with the target ABI - --> $DIR/forbidden-hardfloat-target-feature-attribute.rs:10:18 - | -LL | #[target_feature(enable = "d")] - | ^^^^^^^^^^^^ - -error: aborting due to 1 previous error - diff --git a/tests/ui/target-feature/forbidden-hardfloat-target-feature-flag-disable.aarch64.stderr b/tests/ui/target-feature/forbidden-hardfloat-target-feature-flag-disable.aarch64.stderr deleted file mode 100644 index b1186d5d5dc..00000000000 --- a/tests/ui/target-feature/forbidden-hardfloat-target-feature-flag-disable.aarch64.stderr +++ /dev/null @@ -1,7 +0,0 @@ -warning: target feature `neon` must be enabled to ensure that the ABI of the current target can be implemented correctly - | - = 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 - -warning: 1 warning emitted - diff --git a/tests/ui/target-feature/forbidden-hardfloat-target-feature-flag-disable.rs b/tests/ui/target-feature/forbidden-hardfloat-target-feature-flag-disable.rs deleted file mode 100644 index e0d095844fb..00000000000 --- a/tests/ui/target-feature/forbidden-hardfloat-target-feature-flag-disable.rs +++ /dev/null @@ -1,21 +0,0 @@ -//! Ensure ABI-required features cannot be disabled via `-Ctarget-feature`. -//! Also covers the case of a feature indirectly disabling another via feature implications. -//@ compile-flags: --crate-type=lib -//@ revisions: x86 x86-implied aarch64 -//@[x86] compile-flags: --target=x86_64-unknown-linux-gnu -Ctarget-feature=-x87 -//@[x86] needs-llvm-components: x86 -//@[x86-implied] compile-flags: --target=x86_64-unknown-linux-gnu -Ctarget-feature=-sse -//@[x86-implied] needs-llvm-components: x86 -//@[aarch64] compile-flags: --target=aarch64-unknown-linux-gnu -Ctarget-feature=-neon -//@[aarch64] needs-llvm-components: aarch64 -// For now this is just a warning. -//@ build-pass - -#![feature(no_core, lang_items)] -#![no_core] - -#[lang = "sized"] -pub trait Sized {} - -//~? WARN must be enabled to ensure that the ABI of the current target can be implemented correctly -//[x86]~? WARN unstable feature specified for `-Ctarget-feature` diff --git a/tests/ui/target-feature/forbidden-hardfloat-target-feature-flag-disable.x86-implied.stderr b/tests/ui/target-feature/forbidden-hardfloat-target-feature-flag-disable.x86-implied.stderr deleted file mode 100644 index 7ec8b04cfce..00000000000 --- a/tests/ui/target-feature/forbidden-hardfloat-target-feature-flag-disable.x86-implied.stderr +++ /dev/null @@ -1,7 +0,0 @@ -warning: target feature `sse2` must be enabled to ensure that the ABI of the current target can be implemented correctly - | - = 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 - -warning: 1 warning emitted - diff --git a/tests/ui/target-feature/forbidden-hardfloat-target-feature-flag-disable.x86.stderr b/tests/ui/target-feature/forbidden-hardfloat-target-feature-flag-disable.x86.stderr deleted file mode 100644 index 02398d27501..00000000000 --- a/tests/ui/target-feature/forbidden-hardfloat-target-feature-flag-disable.x86.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: target feature `x87` must be enabled to ensure that the ABI of the current target can be implemented correctly - | - = 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 - -warning: unstable feature specified for `-Ctarget-feature`: `x87` - | - = note: this feature is not stably supported; its behavior can change in the future - -warning: 2 warnings emitted - diff --git a/tests/ui/target-feature/forbidden-hardfloat-target-feature-flag.rs b/tests/ui/target-feature/forbidden-hardfloat-target-feature-flag.rs deleted file mode 100644 index 4ccc6e0e941..00000000000 --- a/tests/ui/target-feature/forbidden-hardfloat-target-feature-flag.rs +++ /dev/null @@ -1,15 +0,0 @@ -//! Ensure ABI-incompatible features cannot be enabled via `-Ctarget-feature`. -//@ compile-flags: --target=x86_64-unknown-linux-gnu --crate-type=lib -//@ needs-llvm-components: x86 -//@ compile-flags: -Ctarget-feature=+soft-float -// For now this is just a warning. -//@ build-pass - -#![feature(no_core, lang_items, riscv_target_feature)] -#![no_core] - -#[lang = "sized"] -pub trait Sized {} - -//~? WARN target feature `soft-float` must be disabled to ensure that the ABI of the current target can be implemented correctl -//~? WARN unstable feature specified for `-Ctarget-feature`: `soft-float` diff --git a/tests/ui/target-feature/forbidden-hardfloat-target-feature-flag.stderr b/tests/ui/target-feature/forbidden-hardfloat-target-feature-flag.stderr deleted file mode 100644 index e49672f33b9..00000000000 --- a/tests/ui/target-feature/forbidden-hardfloat-target-feature-flag.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: target feature `soft-float` must be disabled to ensure that the ABI of the current target can be implemented correctly - | - = 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 - -warning: unstable feature specified for `-Ctarget-feature`: `soft-float` - | - = note: this feature is not stably supported; its behavior can change in the future - -warning: 2 warnings emitted - -- cgit 1.4.1-3-g733a5 From 6873a46626fef5f8f95488272fc605b4847d011e Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Mon, 28 Apr 2025 15:40:44 +0200 Subject: add more revisions to cover more architectures --- ...compatible-target-feature-attribute.riscv.stderr | 8 ++++++++ .../abi-incompatible-target-feature-attribute.rs | 13 +++++++++---- ...abi-incompatible-target-feature-attribute.stderr | 8 -------- ...incompatible-target-feature-attribute.x86.stderr | 8 ++++++++ ...mpatible-target-feature-flag-enable.riscv.stderr | 19 +++++++++++++++++++ .../abi-incompatible-target-feature-flag-enable.rs | 21 ++++++++++++++------- ...i-incompatible-target-feature-flag-enable.stderr | 11 ----------- ...compatible-target-feature-flag-enable.x86.stderr | 11 +++++++++++ ...red-target-feature-flag-disable.loongarch.stderr | 11 +++++++++++ ...equired-target-feature-flag-disable.riscv.stderr | 11 +++++++++++ .../abi-required-target-feature-flag-disable.rs | 10 ++++++++-- 11 files changed, 99 insertions(+), 32 deletions(-) create mode 100644 tests/ui/target-feature/abi-incompatible-target-feature-attribute.riscv.stderr delete mode 100644 tests/ui/target-feature/abi-incompatible-target-feature-attribute.stderr create mode 100644 tests/ui/target-feature/abi-incompatible-target-feature-attribute.x86.stderr create mode 100644 tests/ui/target-feature/abi-incompatible-target-feature-flag-enable.riscv.stderr delete mode 100644 tests/ui/target-feature/abi-incompatible-target-feature-flag-enable.stderr create mode 100644 tests/ui/target-feature/abi-incompatible-target-feature-flag-enable.x86.stderr create mode 100644 tests/ui/target-feature/abi-required-target-feature-flag-disable.loongarch.stderr create mode 100644 tests/ui/target-feature/abi-required-target-feature-flag-disable.riscv.stderr (limited to 'tests/ui') diff --git a/tests/ui/target-feature/abi-incompatible-target-feature-attribute.riscv.stderr b/tests/ui/target-feature/abi-incompatible-target-feature-attribute.riscv.stderr new file mode 100644 index 00000000000..49c5479275f --- /dev/null +++ b/tests/ui/target-feature/abi-incompatible-target-feature-attribute.riscv.stderr @@ -0,0 +1,8 @@ +error: target feature `d` cannot be enabled with `#[target_feature]`: this feature is incompatible with the target ABI + --> $DIR/abi-incompatible-target-feature-attribute.rs:15:90 + | +LL | #[cfg_attr(x86, target_feature(enable = "soft-float"))] #[cfg_attr(riscv, target_feature(enable = "d"))] + | ^^^^^^^^^^^^ + +error: aborting due to 1 previous error + diff --git a/tests/ui/target-feature/abi-incompatible-target-feature-attribute.rs b/tests/ui/target-feature/abi-incompatible-target-feature-attribute.rs index 215e64979f7..a8733440759 100644 --- a/tests/ui/target-feature/abi-incompatible-target-feature-attribute.rs +++ b/tests/ui/target-feature/abi-incompatible-target-feature-attribute.rs @@ -1,12 +1,17 @@ //! Ensure ABI-incompatible features cannot be enabled via `#[target_feature]`. -//@ compile-flags: --target=riscv32e-unknown-none-elf --crate-type=lib -//@ needs-llvm-components: riscv -#![feature(no_core, lang_items, riscv_target_feature)] +// ignore-tidy-linelength +//@ compile-flags: --crate-type=lib +//@ revisions: x86 riscv +//@[x86] compile-flags: --target=x86_64-unknown-linux-gnu +//@[x86] needs-llvm-components: x86 +//@[riscv] compile-flags: --target=riscv32e-unknown-none-elf +//@[riscv] needs-llvm-components: riscv +#![feature(no_core, lang_items, riscv_target_feature, x87_target_feature)] #![no_core] #[lang = "sized"] pub trait Sized {} -#[target_feature(enable = "d")] +#[cfg_attr(x86, target_feature(enable = "soft-float"))] #[cfg_attr(riscv, target_feature(enable = "d"))] //~^ERROR: cannot be enabled with pub unsafe fn my_fun() {} diff --git a/tests/ui/target-feature/abi-incompatible-target-feature-attribute.stderr b/tests/ui/target-feature/abi-incompatible-target-feature-attribute.stderr deleted file mode 100644 index baa8551b17a..00000000000 --- a/tests/ui/target-feature/abi-incompatible-target-feature-attribute.stderr +++ /dev/null @@ -1,8 +0,0 @@ -error: target feature `d` cannot be enabled with `#[target_feature]`: this feature is incompatible with the target ABI - --> $DIR/abi-incompatible-target-feature-attribute.rs:10:18 - | -LL | #[target_feature(enable = "d")] - | ^^^^^^^^^^^^ - -error: aborting due to 1 previous error - diff --git a/tests/ui/target-feature/abi-incompatible-target-feature-attribute.x86.stderr b/tests/ui/target-feature/abi-incompatible-target-feature-attribute.x86.stderr new file mode 100644 index 00000000000..81471fd7e30 --- /dev/null +++ b/tests/ui/target-feature/abi-incompatible-target-feature-attribute.x86.stderr @@ -0,0 +1,8 @@ +error: target feature `soft-float` cannot be enabled with `#[target_feature]`: this feature is incompatible with the target ABI + --> $DIR/abi-incompatible-target-feature-attribute.rs:15:32 + | +LL | #[cfg_attr(x86, target_feature(enable = "soft-float"))] #[cfg_attr(riscv, target_feature(enable = "d"))] + | ^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 1 previous error + diff --git a/tests/ui/target-feature/abi-incompatible-target-feature-flag-enable.riscv.stderr b/tests/ui/target-feature/abi-incompatible-target-feature-flag-enable.riscv.stderr new file mode 100644 index 00000000000..2dca0c22033 --- /dev/null +++ b/tests/ui/target-feature/abi-incompatible-target-feature-flag-enable.riscv.stderr @@ -0,0 +1,19 @@ +warning: target feature `d` must be disabled to ensure that the ABI of the current target can be implemented correctly + | + = 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 + +warning: unstable feature specified for `-Ctarget-feature`: `d` + | + = note: this feature is not stably supported; its behavior can change in the future + +warning: unstable feature specified for `-Ctarget-feature`: `f` + | + = note: this feature is not stably supported; its behavior can change in the future + +warning: unstable feature specified for `-Ctarget-feature`: `zicsr` + | + = note: this feature is not stably supported; its behavior can change in the future + +warning: 4 warnings emitted + diff --git a/tests/ui/target-feature/abi-incompatible-target-feature-flag-enable.rs b/tests/ui/target-feature/abi-incompatible-target-feature-flag-enable.rs index 4ccc6e0e941..68e1d3b9ddc 100644 --- a/tests/ui/target-feature/abi-incompatible-target-feature-flag-enable.rs +++ b/tests/ui/target-feature/abi-incompatible-target-feature-flag-enable.rs @@ -1,15 +1,22 @@ //! Ensure ABI-incompatible features cannot be enabled via `-Ctarget-feature`. -//@ compile-flags: --target=x86_64-unknown-linux-gnu --crate-type=lib -//@ needs-llvm-components: x86 -//@ compile-flags: -Ctarget-feature=+soft-float -// For now this is just a warning. -//@ build-pass +// These are just warnings for now. +//@ check-pass +//@ compile-flags: --crate-type=lib +//@ revisions: x86 riscv +//@[x86] compile-flags: --target=x86_64-unknown-linux-gnu -Ctarget-feature=+soft-float +//@[x86] needs-llvm-components: x86 +//@[riscv] compile-flags: --target=riscv32e-unknown-none-elf -Ctarget-feature=+d +//@[riscv] needs-llvm-components: riscv #![feature(no_core, lang_items, riscv_target_feature)] #![no_core] #[lang = "sized"] pub trait Sized {} +#[lang = "freeze"] +pub trait Freeze {} -//~? WARN target feature `soft-float` must be disabled to ensure that the ABI of the current target can be implemented correctl -//~? WARN unstable feature specified for `-Ctarget-feature`: `soft-float` +//~? 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` +//[riscv]~? WARN unstable feature specified for `-Ctarget-feature` diff --git a/tests/ui/target-feature/abi-incompatible-target-feature-flag-enable.stderr b/tests/ui/target-feature/abi-incompatible-target-feature-flag-enable.stderr deleted file mode 100644 index e49672f33b9..00000000000 --- a/tests/ui/target-feature/abi-incompatible-target-feature-flag-enable.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: target feature `soft-float` must be disabled to ensure that the ABI of the current target can be implemented correctly - | - = 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 - -warning: unstable feature specified for `-Ctarget-feature`: `soft-float` - | - = note: this feature is not stably supported; its behavior can change in the future - -warning: 2 warnings emitted - diff --git a/tests/ui/target-feature/abi-incompatible-target-feature-flag-enable.x86.stderr b/tests/ui/target-feature/abi-incompatible-target-feature-flag-enable.x86.stderr new file mode 100644 index 00000000000..e49672f33b9 --- /dev/null +++ b/tests/ui/target-feature/abi-incompatible-target-feature-flag-enable.x86.stderr @@ -0,0 +1,11 @@ +warning: target feature `soft-float` must be disabled to ensure that the ABI of the current target can be implemented correctly + | + = 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 + +warning: unstable feature specified for `-Ctarget-feature`: `soft-float` + | + = note: this feature is not stably supported; its behavior can change in the future + +warning: 2 warnings emitted + diff --git a/tests/ui/target-feature/abi-required-target-feature-flag-disable.loongarch.stderr b/tests/ui/target-feature/abi-required-target-feature-flag-disable.loongarch.stderr new file mode 100644 index 00000000000..35102e0571f --- /dev/null +++ b/tests/ui/target-feature/abi-required-target-feature-flag-disable.loongarch.stderr @@ -0,0 +1,11 @@ +warning: target feature `d` must be enabled to ensure that the ABI of the current target can be implemented correctly + | + = 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 + +warning: unstable feature specified for `-Ctarget-feature`: `d` + | + = note: this feature is not stably supported; its behavior can change in the future + +warning: 2 warnings emitted + diff --git a/tests/ui/target-feature/abi-required-target-feature-flag-disable.riscv.stderr b/tests/ui/target-feature/abi-required-target-feature-flag-disable.riscv.stderr new file mode 100644 index 00000000000..35102e0571f --- /dev/null +++ b/tests/ui/target-feature/abi-required-target-feature-flag-disable.riscv.stderr @@ -0,0 +1,11 @@ +warning: target feature `d` must be enabled to ensure that the ABI of the current target can be implemented correctly + | + = 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 + +warning: unstable feature specified for `-Ctarget-feature`: `d` + | + = note: this feature is not stably supported; its behavior can change in the future + +warning: 2 warnings emitted + diff --git a/tests/ui/target-feature/abi-required-target-feature-flag-disable.rs b/tests/ui/target-feature/abi-required-target-feature-flag-disable.rs index e0d095844fb..c3ce05baa64 100644 --- a/tests/ui/target-feature/abi-required-target-feature-flag-disable.rs +++ b/tests/ui/target-feature/abi-required-target-feature-flag-disable.rs @@ -1,15 +1,21 @@ //! Ensure ABI-required features cannot be disabled via `-Ctarget-feature`. //! Also covers the case of a feature indirectly disabling another via feature implications. //@ compile-flags: --crate-type=lib -//@ revisions: x86 x86-implied aarch64 +//@ revisions: x86 x86-implied aarch64 riscv loongarch //@[x86] compile-flags: --target=x86_64-unknown-linux-gnu -Ctarget-feature=-x87 //@[x86] needs-llvm-components: x86 //@[x86-implied] compile-flags: --target=x86_64-unknown-linux-gnu -Ctarget-feature=-sse //@[x86-implied] needs-llvm-components: x86 //@[aarch64] compile-flags: --target=aarch64-unknown-linux-gnu -Ctarget-feature=-neon //@[aarch64] needs-llvm-components: aarch64 +//@[riscv] compile-flags: --target=riscv64gc-unknown-none-elf -Ctarget-feature=-d +//@[riscv] needs-llvm-components: riscv +//@[loongarch] compile-flags: --target=loongarch64-unknown-none -Ctarget-feature=-d +//@[loongarch] needs-llvm-components: loongarch // For now this is just a warning. //@ build-pass +// Remove some LLVM warnings that only show up sometimes. +//@ normalize-stderr: "\n[^\n]*(target-abi|lp64f)[^\n]*" -> "" #![feature(no_core, lang_items)] #![no_core] @@ -18,4 +24,4 @@ pub trait Sized {} //~? WARN must be enabled to ensure that the ABI of the current target can be implemented correctly -//[x86]~? WARN unstable feature specified for `-Ctarget-feature` +//[x86,riscv,loongarch]~? WARN unstable feature specified for `-Ctarget-feature` -- cgit 1.4.1-3-g733a5