Rollup merge of #62607 - estebank:this-mem-is-out-of-control, r=petrochenkov
Correctly break out of recovery loop Fix #61858.
This commit is contained in:
commit
a7f1649fbb
3 changed files with 16 additions and 2 deletions
|
|
@ -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();
|
||||
|
|
@ -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;
|
||||
|
|
|
|||
3
src/test/ui/issues/issue-61858.rs
Normal file
3
src/test/ui/issues/issue-61858.rs
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
fn main() {
|
||||
(if foobar) //~ ERROR expected `{`, found `)`
|
||||
}
|
||||
10
src/test/ui/issues/issue-61858.stderr
Normal file
10
src/test/ui/issues/issue-61858.stderr
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
error: expected `{`, found `)`
|
||||
--> $DIR/issue-61858.rs:2:15
|
||||
|
|
||||
LL | (if foobar)
|
||||
| -- ^ expected `{`
|
||||
| |
|
||||
| this `if` statement has a condition, but no block
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue