Continue to borrowck even if there were previous errors

This commit is contained in:
Oli Scherer 2024-02-01 22:45:00 +00:00
parent e5461de392
commit eab2adb660
198 changed files with 3222 additions and 494 deletions

View file

@ -2911,12 +2911,22 @@ impl<'a> Parser<'a> {
Ok(arm) => arms.push(arm),
Err(e) => {
// Recover by skipping to the end of the block.
e.emit();
let guar = e.emit();
self.recover_stmt();
let span = lo.to(self.token.span);
if self.token == token::CloseDelim(Delimiter::Brace) {
self.bump();
}
// Always push at least one arm to make the match non-empty
arms.push(Arm {
attrs: Default::default(),
pat: self.mk_pat(span, ast::PatKind::Err(guar)),
guard: None,
body: Some(self.mk_expr_err(span)),
span,
id: DUMMY_NODE_ID,
is_placeholder: false,
});
return Ok(self.mk_expr_with_attrs(
span,
ExprKind::Match(scrutinee, arms),