diff options
| author | Jubilee Young <workingjubilee@gmail.com> | 2025-06-06 12:02:01 -0700 |
|---|---|---|
| committer | Jubilee Young <workingjubilee@gmail.com> | 2025-06-23 09:40:00 -0700 |
| commit | 78528bc0e69d57182cadd802ad099d381a0e2621 (patch) | |
| tree | 8c64bb143c22f11c889559d3a510bd72030218c5 | |
| parent | 7632fab6689770d0f482851781e9735d7b8f5f5e (diff) | |
| download | rust-78528bc0e69d57182cadd802ad099d381a0e2621.tar.gz rust-78528bc0e69d57182cadd802ad099d381a0e2621.zip | |
tests: Verify varargs with unsupported fn ptr ABIs must error
| -rw-r--r-- | tests/ui/abi/unsupported-varargs-fnptr.rs | 18 | ||||
| -rw-r--r-- | tests/ui/abi/unsupported-varargs-fnptr.stderr | 9 |
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`. |
