c8b76bcf58
On some architectures, vector types may have a different ABI depending on whether the relevant target features are enabled. (The ABI when the feature is disabled is often not specified, but LLVM implements some de-facto ABI.) As discussed in rust-lang/lang-team#235, this turns out to very easily lead to unsound code. This commit makes it a post-monomorphization future-incompat warning to declare or call functions using those vector types in a context in which the corresponding target features are disabled, if using an ABI for which the difference is relevant. This ensures that these functions are always called with a consistent ABI. See the [nomination comment](https://github.com/rust-lang/rust/pull/127731#issuecomment-2288558187) for more discussion. Part of #116558
94 lines
5.4 KiB
Plaintext
94 lines
5.4 KiB
Plaintext
warning: ABI error: this function call uses a vector type that requires the `avx` target feature, which is not enabled in the caller
|
|
--> $DIR/simd-abi-checks.rs:55:11
|
|
|
|
|
LL | f(g());
|
|
| ^^^ function called here
|
|
|
|
|
= warning: 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 #116558 <https://github.com/rust-lang/rust/issues/116558>
|
|
= help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`)
|
|
= note: `#[warn(abi_unsupported_vector_types)]` on by default
|
|
|
|
warning: ABI error: this function call uses a vector type that requires the `avx` target feature, which is not enabled in the caller
|
|
--> $DIR/simd-abi-checks.rs:55:9
|
|
|
|
|
LL | f(g());
|
|
| ^^^^^^ function called here
|
|
|
|
|
= warning: 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 #116558 <https://github.com/rust-lang/rust/issues/116558>
|
|
= help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`)
|
|
|
|
warning: ABI error: this function call uses a vector type that requires the `avx` target feature, which is not enabled in the caller
|
|
--> $DIR/simd-abi-checks.rs:63:14
|
|
|
|
|
LL | gavx(favx());
|
|
| ^^^^^^ function called here
|
|
|
|
|
= warning: 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 #116558 <https://github.com/rust-lang/rust/issues/116558>
|
|
= help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`)
|
|
|
|
warning: ABI error: this function call uses a vector type that requires the `avx` target feature, which is not enabled in the caller
|
|
--> $DIR/simd-abi-checks.rs:63:9
|
|
|
|
|
LL | gavx(favx());
|
|
| ^^^^^^^^^^^^ function called here
|
|
|
|
|
= warning: 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 #116558 <https://github.com/rust-lang/rust/issues/116558>
|
|
= help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`)
|
|
|
|
warning: ABI error: this function call uses a vector type that requires the `avx` target feature, which is not enabled in the caller
|
|
--> $DIR/simd-abi-checks.rs:75:19
|
|
|
|
|
LL | w(Wrapper(g()));
|
|
| ^^^ function called here
|
|
|
|
|
= warning: 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 #116558 <https://github.com/rust-lang/rust/issues/116558>
|
|
= help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`)
|
|
|
|
warning: ABI error: this function call uses a vector type that requires the `avx` target feature, which is not enabled in the caller
|
|
--> $DIR/simd-abi-checks.rs:75:9
|
|
|
|
|
LL | w(Wrapper(g()));
|
|
| ^^^^^^^^^^^^^^^ function called here
|
|
|
|
|
= warning: 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 #116558 <https://github.com/rust-lang/rust/issues/116558>
|
|
= help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`)
|
|
|
|
warning: ABI error: this function definition uses a vector type that requires the `avx` target feature, which is not enabled
|
|
--> $DIR/simd-abi-checks.rs:26:1
|
|
|
|
|
LL | unsafe extern "C" fn g() -> __m256 {
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here
|
|
|
|
|
= warning: 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 #116558 <https://github.com/rust-lang/rust/issues/116558>
|
|
= help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`)
|
|
|
|
warning: ABI error: this function definition uses a vector type that requires the `avx` target feature, which is not enabled
|
|
--> $DIR/simd-abi-checks.rs:20:1
|
|
|
|
|
LL | unsafe extern "C" fn f(_: __m256) {
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here
|
|
|
|
|
= warning: 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 #116558 <https://github.com/rust-lang/rust/issues/116558>
|
|
= help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`)
|
|
|
|
warning: ABI error: this function definition uses a vector type that requires the `avx` target feature, which is not enabled
|
|
--> $DIR/simd-abi-checks.rs:14:1
|
|
|
|
|
LL | unsafe extern "C" fn w(_: Wrapper) {
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here
|
|
|
|
|
= warning: 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 #116558 <https://github.com/rust-lang/rust/issues/116558>
|
|
= help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`)
|
|
|
|
warning: 9 warnings emitted
|
|
|