summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2025-06-24 19:32:29 +0000
committerJosh Stone <jistone@redhat.com>2025-07-17 14:02:06 -0700
commit7e0eb3bc6df7199c908eb095ff63635e4c2239b0 (patch)
treeb7d5ceb1ffeb65672243e81da94ad6b78e9e1e7c /tests
parentc9ba9aab8ca58ab079e9c892eabd1bff340eb386 (diff)
downloadrust-7e0eb3bc6df7199c908eb095ff63635e4c2239b0.tar.gz
rust-7e0eb3bc6df7199c908eb095ff63635e4c2239b0.zip
Taint body on invalid call ABI
(cherry picked from commit e776065164f22872e8cadf5bc5e47352c27982dc)
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/abi/invalid-call-abi-ctfe.rs14
-rw-r--r--tests/ui/abi/invalid-call-abi-ctfe.stderr9
2 files changed, 23 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..c72b72c152c
--- /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..df4727a2802
--- /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:1
+   |
+LL | const extern "rust-invalid" fn foo() {
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0570`.