summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
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`.