Skip to content

Commit 690cf8d

Browse files
tests: Verify varargs with unsupported fn ptr ABIs must error
1 parent c39f27a commit 690cf8d

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// FIXME(workingjubilee): add revisions and generalize to other platform-specific varargs ABIs,
2+
// preferably after the only-arch directive is enhanced with an "or pattern" syntax
3+
//@ only-x86_64
4+
5+
// We have to use this flag to force ABI computation of an invalid ABI
6+
//@ compile-flags: -Clink-dead-code
7+
8+
#![feature(extended_varargs_abi_support)]
9+
10+
// sometimes fn ptrs with varargs make layout and ABI computation ICE
11+
// as found in https://github.com/rust-lang/rust/issues/142107
12+
13+
fn aapcs(f: extern "aapcs" fn(usize, ...)) {
14+
//~^ ERROR [E0570]
15+
// Note we DO NOT have to actually make a call to trigger the ICE!
16+
}
17+
18+
fn main() {}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
error[E0570]: "aapcs" is not a supported ABI for the current target
2+
--> $DIR/unsupported-varargs-fnptr.rs:13:20
3+
|
4+
LL | fn aapcs(f: extern "aapcs" fn(usize, ...)) {
5+
| ^^^^^^^
6+
7+
error: aborting due to 1 previous error
8+
9+
For more information about this error, try `rustc --explain E0570`.

0 commit comments

Comments
 (0)