Continue to borrowck even if there were previous errors
This commit is contained in:
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user