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
This commit is contained in:
Folkert de Vries 2025-09-13 20:50:56 +02:00
parent a84bb32e05
commit d28c31a600
No known key found for this signature in database
GPG Key ID: 1F17F6FFD112B97C
2 changed files with 22 additions and 0 deletions

View File

@ -0,0 +1,14 @@
#![expect(incomplete_features)]
#![feature(c_variadic, explicit_tail_calls)]
#![allow(unused)]
unsafe extern "C" fn foo(mut ap: ...) -> u32 {
ap.arg::<u32>()
}
extern "C" fn bar() -> u32 {
unsafe { become foo(1, 2, 3) }
//~^ ERROR c-variadic functions can't be tail-called
}
fn main() {}

View File

@ -0,0 +1,8 @@
error: c-variadic functions can't be tail-called
--> $DIR/c-variadic.rs:10:14
|
LL | unsafe { become foo(1, 2, 3) }
| ^^^^^^^^^^^^^^^^^^^
error: aborting due to 1 previous error