about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--tests/ui/abi/unsupported-varargs-fnptr.rs18
-rw-r--r--tests/ui/abi/unsupported-varargs-fnptr.stderr9
2 files changed, 27 insertions, 0 deletions
diff --git a/tests/ui/abi/unsupported-varargs-fnptr.rs b/tests/ui/abi/unsupported-varargs-fnptr.rs
new file mode 100644
index 00000000000..733e16c7e4b
--- /dev/null
+++ b/tests/ui/abi/unsupported-varargs-fnptr.rs
@@ -0,0 +1,18 @@
+// FIXME(workingjubilee): add revisions and generalize to other platform-specific varargs ABIs,
+// preferably after the only-arch directive is enhanced with an "or pattern" syntax
+//@ only-x86_64
+
+// We have to use this flag to force ABI computation of an invalid ABI
+//@ compile-flags: -Clink-dead-code
+
+#![feature(extended_varargs_abi_support)]
+
+// sometimes fn ptrs with varargs make layout and ABI computation ICE
+// as found in https://github.com/rust-lang/rust/issues/142107
+
+fn aapcs(f: extern "aapcs" fn(usize, ...)) {
+//~^ ERROR [E0570]
+// Note we DO NOT have to actually make a call to trigger the ICE!
+}
+
+fn main() {}
diff --git a/tests/ui/abi/unsupported-varargs-fnptr.stderr b/tests/ui/abi/unsupported-varargs-fnptr.stderr
new file mode 100644
index 00000000000..445e57df9d8
--- /dev/null
+++ b/tests/ui/abi/unsupported-varargs-fnptr.stderr
@@ -0,0 +1,9 @@
+error[E0570]: "aapcs" is not a supported ABI for the current target
+  --> $DIR/unsupported-varargs-fnptr.rs:13:20
+   |
+LL | fn aapcs(f: extern "aapcs" fn(usize, ...)) {
+   |                    ^^^^^^^
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0570`.