syntax: account for CVarArgs being in the argument list.
This commit is contained in:
parent
72f8043d44
commit
34dcca20e5
3 changed files with 15 additions and 1 deletions
|
@ -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");
|
||||||
}
|
}
|
||||||
|
|
6
src/test/ui/c-variadic/variadic-ffi-no-fixed-args.rs
Normal file
6
src/test/ui/c-variadic/variadic-ffi-no-fixed-args.rs
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
extern {
|
||||||
|
fn foo(...);
|
||||||
|
//~^ ERROR C-variadic function must be declared with at least one named argument
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {}
|
8
src/test/ui/c-variadic/variadic-ffi-no-fixed-args.stderr
Normal file
8
src/test/ui/c-variadic/variadic-ffi-no-fixed-args.stderr
Normal 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
|
||||||
|
|
Loading…
Add table
Reference in a new issue