2019-12-01 19:38:33 -06:00
|
|
|
#![feature(c_variadic)]
|
2021-03-08 17:43:18 -06:00
|
|
|
#![allow(anonymous_parameters)]
|
2019-12-01 19:38:33 -06:00
|
|
|
|
|
|
|
fn main() {}
|
|
|
|
|
2019-12-01 20:16:12 -06:00
|
|
|
fn f1_1(x: isize, ...) {}
|
2021-06-09 05:41:03 -05:00
|
|
|
//~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic
|
2019-12-01 19:38:33 -06:00
|
|
|
|
2019-12-01 20:16:12 -06:00
|
|
|
fn f1_2(...) {}
|
2021-06-09 05:41:03 -05:00
|
|
|
//~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic
|
2019-12-01 20:16:12 -06:00
|
|
|
//~| ERROR C-variadic function must be declared with at least one named argument
|
2019-12-01 19:38:33 -06:00
|
|
|
|
2019-12-01 20:16:12 -06:00
|
|
|
extern "C" fn f2_1(x: isize, ...) {}
|
2021-06-09 05:41:03 -05:00
|
|
|
//~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic
|
2019-12-01 20:16:12 -06:00
|
|
|
|
|
|
|
extern "C" fn f2_2(...) {}
|
2021-06-09 05:41:03 -05:00
|
|
|
//~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic
|
2019-12-01 20:16:12 -06:00
|
|
|
//~| ERROR C-variadic function must be declared with at least one named argument
|
|
|
|
|
|
|
|
extern "C" fn f2_3(..., x: isize) {}
|
2021-06-09 05:41:03 -05:00
|
|
|
//~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic
|
2019-12-01 20:16:12 -06:00
|
|
|
//~| ERROR `...` must be the last argument of a C-variadic function
|
|
|
|
|
2020-09-01 16:12:52 -05:00
|
|
|
extern "C" fn f3_1(x: isize, ...) {}
|
2021-06-09 05:41:03 -05:00
|
|
|
//~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic
|
2019-12-01 20:16:12 -06:00
|
|
|
|
2020-09-01 16:12:52 -05:00
|
|
|
extern "C" fn f3_2(...) {}
|
2021-06-09 05:41:03 -05:00
|
|
|
//~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic
|
2019-12-01 20:16:12 -06:00
|
|
|
//~| ERROR C-variadic function must be declared with at least one named argument
|
|
|
|
|
2020-09-01 16:12:52 -05:00
|
|
|
extern "C" fn f3_3(..., x: isize) {}
|
2021-06-09 05:41:03 -05:00
|
|
|
//~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic
|
2019-12-01 20:16:12 -06:00
|
|
|
//~| ERROR `...` must be the last argument of a C-variadic function
|
|
|
|
|
2020-09-01 16:12:52 -05:00
|
|
|
extern "C" {
|
2019-12-01 20:16:12 -06:00
|
|
|
fn e_f1(...);
|
|
|
|
//~^ ERROR C-variadic function must be declared with at least one named argument
|
|
|
|
fn e_f2(..., x: isize);
|
2020-09-01 16:12:52 -05:00
|
|
|
//~^ ERROR `...` must be the last argument of a C-variadic function
|
2019-12-01 20:16:12 -06:00
|
|
|
}
|
2019-12-01 19:38:33 -06:00
|
|
|
|
|
|
|
struct X;
|
|
|
|
|
|
|
|
impl X {
|
2019-12-01 20:16:12 -06:00
|
|
|
fn i_f1(x: isize, ...) {}
|
2021-06-09 05:41:03 -05:00
|
|
|
//~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic
|
2019-12-01 20:16:12 -06:00
|
|
|
fn i_f2(...) {}
|
2021-06-09 05:41:03 -05:00
|
|
|
//~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic
|
2019-12-01 20:16:12 -06:00
|
|
|
//~| ERROR C-variadic function must be declared with at least one named argument
|
|
|
|
fn i_f3(..., x: isize, ...) {}
|
2021-06-09 05:41:03 -05:00
|
|
|
//~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic
|
|
|
|
//~| ERROR only foreign or `unsafe extern "C"` functions may be C-variadic
|
2019-12-01 20:16:12 -06:00
|
|
|
//~| ERROR `...` must be the last argument of a C-variadic function
|
|
|
|
fn i_f4(..., x: isize, ...) {}
|
2021-06-09 05:41:03 -05:00
|
|
|
//~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic
|
|
|
|
//~| ERROR only foreign or `unsafe extern "C"` functions may be C-variadic
|
2019-12-01 20:16:12 -06:00
|
|
|
//~| ERROR `...` must be the last argument of a C-variadic function
|
2019-12-01 19:38:33 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
trait T {
|
2019-12-01 20:16:12 -06:00
|
|
|
fn t_f1(x: isize, ...) {}
|
2021-06-09 05:41:03 -05:00
|
|
|
//~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic
|
2019-12-01 20:16:12 -06:00
|
|
|
fn t_f2(x: isize, ...);
|
2021-06-09 05:41:03 -05:00
|
|
|
//~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic
|
2019-12-01 20:16:12 -06:00
|
|
|
fn t_f3(...) {}
|
2021-06-09 05:41:03 -05:00
|
|
|
//~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic
|
2019-12-01 20:16:12 -06:00
|
|
|
//~| ERROR C-variadic function must be declared with at least one named argument
|
|
|
|
fn t_f4(...);
|
2021-06-09 05:41:03 -05:00
|
|
|
//~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic
|
2019-12-01 20:16:12 -06:00
|
|
|
//~| ERROR C-variadic function must be declared with at least one named argument
|
|
|
|
fn t_f5(..., x: isize) {}
|
2021-06-09 05:41:03 -05:00
|
|
|
//~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic
|
2019-12-01 20:16:12 -06:00
|
|
|
//~| ERROR `...` must be the last argument of a C-variadic function
|
|
|
|
fn t_f6(..., x: isize);
|
2021-06-09 05:41:03 -05:00
|
|
|
//~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic
|
2019-12-01 20:16:12 -06:00
|
|
|
//~| ERROR `...` must be the last argument of a C-variadic function
|
2019-12-01 19:38:33 -06:00
|
|
|
}
|