Skip to content

Commit bc8f0dd

Browse files
estebankpietroalbini
authored andcommitted
Correctly break out of recovery loop
1 parent dc925be commit bc8f0dd

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/libsyntax/parse/parser.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -4675,6 +4675,9 @@ impl<'a> Parser<'a> {
46754675
fn parse_block_tail(&mut self, lo: Span, s: BlockCheckMode) -> PResult<'a, P<Block>> {
46764676
let mut stmts = vec![];
46774677
while !self.eat(&token::CloseDelim(token::Brace)) {
4678+
if self.token == token::Eof {
4679+
break;
4680+
}
46784681
let stmt = match self.parse_full_stmt(false) {
46794682
Err(mut err) => {
46804683
err.emit();
@@ -4689,8 +4692,6 @@ impl<'a> Parser<'a> {
46894692
};
46904693
if let Some(stmt) = stmt {
46914694
stmts.push(stmt);
4692-
} else if self.token == token::Eof {
4693-
break;
46944695
} else {
46954696
// Found only `;` or `}`.
46964697
continue;

0 commit comments

Comments
 (0)