Accept trailing commas in struct patterns
We decided in the 12/10/13 weekly meeting that trailing commas should be accepted pretty much anywhere. They are currently not allowed in struct patterns, and this commit adds support for that. Closes #10392
This commit is contained in:
parent
e86cdaf23d
commit
bfb760c697
4 changed files with 79 additions and 2 deletions
|
@ -2800,8 +2800,13 @@ impl Parser {
|
|||
let mut etc = false;
|
||||
let mut first = true;
|
||||
while *self.token != token::RBRACE {
|
||||
if first { first = false; }
|
||||
else { self.expect(&token::COMMA); }
|
||||
if first {
|
||||
first = false;
|
||||
} else {
|
||||
self.expect(&token::COMMA);
|
||||
// accept trailing commas
|
||||
if *self.token == token::RBRACE { break }
|
||||
}
|
||||
|
||||
etc = *self.token == token::UNDERSCORE || *self.token == token::DOTDOT;
|
||||
if *self.token == token::UNDERSCORE {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue