about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-08-14 04:18:40 +0200
committerGitHub <noreply@github.com>2019-08-14 04:18:40 +0200
commit76bd7d62d6ff665631d5415eadebc8142f0aee2d (patch)
tree1f9845def4a9d27b642397f1cc88c3f6b4c2f32f /src/libsyntax
parentb5df4bb7eb8cd10d31966d86482d6dfb501547fc (diff)
parent34dcca20e5909513f08d1c21df1168357c3b6b6a (diff)
downloadrust-76bd7d62d6ff665631d5415eadebc8142f0aee2d.tar.gz
rust-76bd7d62d6ff665631d5415eadebc8142f0aee2d.zip
Rollup merge of #63459 - eddyb:issue-63430, r=petrochenkov
syntax: account for CVarArgs being in the argument list.

Fixes #63430 by testing for `1` argument (the `CVarArgs` itself) instead of `0`.

Note that the error has basically been impossible to trigger since the change that caused #63430, so perhaps we need an audit of untested errors.

Also, this check probably belongs in AST validation/HIR lowering, but I'd rather fix it in place for now.

r? @petrochenkov cc @dlrobertson
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/parse/parser.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 1c1428c5713..2286e74e633 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -1236,7 +1236,7 @@ impl<'a> Parser<'a> {
 
         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,
                           "C-variadic function must be declared with at least one named argument");
         }