syntax: account for CVarArgs being in the argument list.

This commit is contained in:
Eduard-Mihai Burtescu 2019-08-11 08:25:30 +03:00
parent 72f8043d44
commit 34dcca20e5
3 changed files with 15 additions and 1 deletions

View file

@ -1236,7 +1236,7 @@ impl<'a> Parser<'a> {
let args: Vec<_> = args.into_iter().filter_map(|x| x).collect(); let args: Vec<_> = args.into_iter().filter_map(|x| x).collect();
if c_variadic && args.is_empty() { if c_variadic && args.len() <= 1 {
self.span_err(sp, self.span_err(sp,
"C-variadic function must be declared with at least one named argument"); "C-variadic function must be declared with at least one named argument");
} }

View file

@ -0,0 +1,6 @@
extern {
fn foo(...);
//~^ ERROR C-variadic function must be declared with at least one named argument
}
fn main() {}

View file

@ -0,0 +1,8 @@
error: C-variadic function must be declared with at least one named argument
--> $DIR/variadic-ffi-no-fixed-args.rs:2:11
|
LL | fn foo(...);
| ^
error: aborting due to previous error