Skip to content

Commit

Permalink
Correctly break out of recovery loop
Browse files Browse the repository at this point in the history
  • Loading branch information
estebank committed Jul 12, 2019
1 parent 4bb6b4a commit cc481a4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/libsyntax/parse/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4629,6 +4629,9 @@ impl<'a> Parser<'a> {
fn parse_block_tail(&mut self, lo: Span, s: BlockCheckMode) -> PResult<'a, P<Block>> {
let mut stmts = vec![];
while !self.eat(&token::CloseDelim(token::Brace)) {
if self.token == token::Eof {
break;
}
let stmt = match self.parse_full_stmt(false) {
Err(mut err) => {
err.emit();
Expand All @@ -4643,8 +4646,6 @@ impl<'a> Parser<'a> {
};
if let Some(stmt) = stmt {
stmts.push(stmt);
} else if self.token == token::Eof {
break;
} else {
// Found only `;` or `}`.
continue;
Expand Down

0 comments on commit cc481a4

Please sign in to comment.