Address review comments

This commit is contained in:
Vadim Petrochenkov
2016-03-06 15:54:44 +03:00
parent d69aeaf662
commit c038b45423
12 changed files with 355 additions and 211 deletions

View File

@@ -3426,6 +3426,10 @@ impl<'a> Parser<'a> {
// `..` needs to be followed by `)` or `, pat`, `..,)` is disallowed.
fields.push(self.parse_pat()?);
}
} else if ddpos.is_some() && self.eat(&token::DotDot) {
// Emit a friendly error, ignore `..` and continue parsing
self.span_err(self.last_span, "`..` can only be used once per \
tuple or tuple struct pattern");
} else {
fields.push(self.parse_pat()?);
}