diff options
| author | bors <bors@rust-lang.org> | 2014-01-22 09:21:25 -0800 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-01-22 09:21:25 -0800 |
| commit | de50c56a5c20759565f4cba8b1329fba66cc56c9 (patch) | |
| tree | 89a4e74cffc1abce8a9fb7d8ea11af1ae044414d /src/libsyntax/parse/parser.rs | |
| parent | 750d48b0ad1854b389ce1c209484f9146dc7aba0 (diff) | |
| parent | 7689353918aa2ba93b432bc96f2f6dca8665e7bc (diff) | |
| download | rust-de50c56a5c20759565f4cba8b1329fba66cc56c9.tar.gz rust-de50c56a5c20759565f4cba8b1329fba66cc56c9.zip | |
auto merge of #11727 : sanxiyn/rust/trailing-comma, r=alexcrichton
Fix #6506. Fix #7358.
Diffstat (limited to 'src/libsyntax/parse/parser.rs')
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 4e1703fe6b0..557e7e04ebf 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -2021,7 +2021,7 @@ impl Parser { let es = self.parse_unspanned_seq( &token::LPAREN, &token::RPAREN, - seq_sep_trailing_disallowed(token::COMMA), + seq_sep_trailing_allowed(token::COMMA), |p| p.parse_expr() ); hi = self.last_span.hi; @@ -2994,6 +2994,7 @@ impl Parser { if self.look_ahead(1, |t| *t != token::RPAREN) { while self.token == token::COMMA { self.bump(); + if self.token == token::RPAREN { break; } fields.push(self.parse_pat()); } } @@ -3573,7 +3574,7 @@ impl Parser { self.parse_unspanned_seq( &token::LPAREN, &token::RPAREN, - seq_sep_trailing_disallowed(token::COMMA), + seq_sep_trailing_allowed(token::COMMA), |p| { if p.token == token::DOTDOTDOT { p.bump(); |
