diff options
| author | Jubilee <workingjubilee@gmail.com> | 2025-06-24 19:45:36 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-24 19:45:36 -0700 |
| commit | 0f77e836c68d6cdde95f30a99ffd20d6bb727996 (patch) | |
| tree | a7962c7b2e489daa0a304e346c1f5387a3bcb98d /tests | |
| parent | d392e8803bfd36700157dc105ea51c3df9fd98b5 (diff) | |
| parent | e776065164f22872e8cadf5bc5e47352c27982dc (diff) | |
| download | rust-0f77e836c68d6cdde95f30a99ffd20d6bb727996.tar.gz rust-0f77e836c68d6cdde95f30a99ffd20d6bb727996.zip | |
Rollup merge of #142983 - compiler-errors:taint-invalid-call-abi, r=workingjubilee
Taint body on invalid call ABI Fixes https://github.com/rust-lang/rust/issues/142969 I'm not certain if there are any other paths that should be tainted, but they would operate similarly. Perhaps pointer coercion. Introduces `extern "rust-invalid"` for testing purposes. r? ```@workingjubilee``` or ```@oli-obk``` (or anyone)
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/ui/abi/invalid-call-abi-ctfe.rs | 14 | ||||
| -rw-r--r-- | tests/ui/abi/invalid-call-abi-ctfe.stderr | 9 | ||||
| -rw-r--r-- | tests/ui/abi/invalid-call-abi.rs | 12 | ||||
| -rw-r--r-- | tests/ui/abi/invalid-call-abi.stderr | 9 | ||||
| -rw-r--r-- | tests/ui/print-calling-conventions.stdout | 1 |
5 files changed, 45 insertions, 0 deletions
diff --git a/tests/ui/abi/invalid-call-abi-ctfe.rs b/tests/ui/abi/invalid-call-abi-ctfe.rs new file mode 100644 index 00000000000..343cc728fe3 --- /dev/null +++ b/tests/ui/abi/invalid-call-abi-ctfe.rs @@ -0,0 +1,14 @@ +// Fix for #142969 where an invalid ABI in a signature still had its call ABI computed +// because CTFE tried to evaluate it, despite previous errors during AST-to-HIR lowering. + +#![feature(rustc_attrs)] + +const extern "rust-invalid" fn foo() { + //~^ ERROR "rust-invalid" is not a supported ABI for the current target + panic!() +} + +const _: () = foo(); + + +fn main() {} diff --git a/tests/ui/abi/invalid-call-abi-ctfe.stderr b/tests/ui/abi/invalid-call-abi-ctfe.stderr new file mode 100644 index 00000000000..402de4b69b9 --- /dev/null +++ b/tests/ui/abi/invalid-call-abi-ctfe.stderr @@ -0,0 +1,9 @@ +error[E0570]: "rust-invalid" is not a supported ABI for the current target + --> $DIR/invalid-call-abi-ctfe.rs:6:14 + | +LL | const extern "rust-invalid" fn foo() { + | ^^^^^^^^^^^^^^ + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0570`. diff --git a/tests/ui/abi/invalid-call-abi.rs b/tests/ui/abi/invalid-call-abi.rs new file mode 100644 index 00000000000..076ddd91ab0 --- /dev/null +++ b/tests/ui/abi/invalid-call-abi.rs @@ -0,0 +1,12 @@ +// Tests the `"rustc-invalid"` ABI, which is never canonizable. + +#![feature(rustc_attrs)] + +const extern "rust-invalid" fn foo() { + //~^ ERROR "rust-invalid" is not a supported ABI for the current target + panic!() +} + +fn main() { + foo(); +} diff --git a/tests/ui/abi/invalid-call-abi.stderr b/tests/ui/abi/invalid-call-abi.stderr new file mode 100644 index 00000000000..c4a90158dcf --- /dev/null +++ b/tests/ui/abi/invalid-call-abi.stderr @@ -0,0 +1,9 @@ +error[E0570]: "rust-invalid" is not a supported ABI for the current target + --> $DIR/invalid-call-abi.rs:5:14 + | +LL | const extern "rust-invalid" fn foo() { + | ^^^^^^^^^^^^^^ + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0570`. diff --git a/tests/ui/print-calling-conventions.stdout b/tests/ui/print-calling-conventions.stdout index 7b5ae495660..4df6bd27f45 100644 --- a/tests/ui/print-calling-conventions.stdout +++ b/tests/ui/print-calling-conventions.stdout @@ -20,6 +20,7 @@ riscv-interrupt-m riscv-interrupt-s rust-call rust-cold +rust-invalid stdcall stdcall-unwind system |
