Skip to content

Commit d28c31a

Browse files
committed
c-variadic: check that c-variadic functions cannot be tail-called
as far as I can see this was not tested, though the error message was already implemented
1 parent a84bb32 commit d28c31a

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#![expect(incomplete_features)]
2+
#![feature(c_variadic, explicit_tail_calls)]
3+
#![allow(unused)]
4+
5+
unsafe extern "C" fn foo(mut ap: ...) -> u32 {
6+
ap.arg::<u32>()
7+
}
8+
9+
extern "C" fn bar() -> u32 {
10+
unsafe { become foo(1, 2, 3) }
11+
//~^ ERROR c-variadic functions can't be tail-called
12+
}
13+
14+
fn main() {}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
error: c-variadic functions can't be tail-called
2+
--> $DIR/c-variadic.rs:10:14
3+
|
4+
LL | unsafe { become foo(1, 2, 3) }
5+
| ^^^^^^^^^^^^^^^^^^^
6+
7+
error: aborting due to 1 previous error
8+

0 commit comments

Comments
 (0)