Skip to content

Commit

Permalink
Rollup merge of #63202 - exphp-forks:parser-ice-63135, r=estebank
Browse files Browse the repository at this point in the history
Fix ICE in #63135

Closes #63135.

r?@estebank
  • Loading branch information
Centril authored Aug 2, 2019
2 parents 89dce46 + b3321fb commit 3396550
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/libsyntax/parse/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3592,7 +3592,15 @@ impl<'a> Parser<'a> {
let mut etc_span = None;

while self.token != token::CloseDelim(token::Brace) {
let attrs = self.parse_outer_attributes()?;
let attrs = match self.parse_outer_attributes() {
Ok(attrs) => attrs,
Err(err) => {
if let Some(mut delayed) = delayed_err {
delayed.emit();
}
return Err(err);
},
};
let lo = self.token.span;

// check that a comma comes after every field
Expand Down
3 changes: 3 additions & 0 deletions src/test/ui/parser/issue-63135.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// error-pattern: aborting due to 6 previous errors

fn i(n{...,f #
44 changes: 44 additions & 0 deletions src/test/ui/parser/issue-63135.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
error: this file contains an un-closed delimiter
--> $DIR/issue-63135.rs:3:16
|
LL | fn i(n{...,f #
| - - ^
| | |
| | un-closed delimiter
| un-closed delimiter

error: expected field pattern, found `...`
--> $DIR/issue-63135.rs:3:8
|
LL | fn i(n{...,f #
| ^^^ help: to omit remaining fields, use one fewer `.`: `..`

error: expected `}`, found `,`
--> $DIR/issue-63135.rs:3:11
|
LL | fn i(n{...,f #
| ---^
| | |
| | expected `}`
| `..` must be at the end and cannot have a trailing comma

error: expected `[`, found `}`
--> $DIR/issue-63135.rs:3:15
|
LL | fn i(n{...,f #
| ^ expected `[`

error: expected `:`, found `)`
--> $DIR/issue-63135.rs:3:15
|
LL | fn i(n{...,f #
| ^ expected `:`

error: expected one of `->`, `where`, or `{`, found `<eof>`
--> $DIR/issue-63135.rs:3:15
|
LL | fn i(n{...,f #
| ^ expected one of `->`, `where`, or `{` here

error: aborting due to 6 previous errors

0 comments on commit 3396550

Please sign in to comment.