Skip to content

Commit cc481a4

Browse files
committed
Correctly break out of recovery loop
1 parent 4bb6b4a commit cc481a4

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
@@ -4629,6 +4629,9 @@ impl<'a> Parser<'a> {
46294629
fn parse_block_tail(&mut self, lo: Span, s: BlockCheckMode) -> PResult<'a, P<Block>> {
46304630
let mut stmts = vec![];
46314631
while !self.eat(&token::CloseDelim(token::Brace)) {
4632+
if self.token == token::Eof {
4633+
break;
4634+
}
46324635
let stmt = match self.parse_full_stmt(false) {
46334636
Err(mut err) => {
46344637
err.emit();
@@ -4643,8 +4646,6 @@ impl<'a> Parser<'a> {
46434646
};
46444647
if let Some(stmt) = stmt {
46454648
stmts.push(stmt);
4646-
} else if self.token == token::Eof {
4647-
break;
46484649
} else {
46494650
// Found only `;` or `}`.
46504651
continue;

0 commit comments

Comments
 (0)