diff options
| author | bors <bors@rust-lang.org> | 2024-02-10 05:15:14 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-02-10 05:15:14 +0000 |
| commit | 5a3a2d5a5ea80b04df3fd3406f2bd924763d78a6 (patch) | |
| tree | 455bc9533122fc3f9c651366a44d110a9099eb8a /compiler/rustc_parse/src/parser/expr.rs | |
| parent | a5077d998934d0bb04bda2be1d0afe24b3170b16 (diff) | |
| parent | 45d5d4b1b3e728f2da0707062482d3bb4611586f (diff) | |
| download | rust-5a3a2d5a5ea80b04df3fd3406f2bd924763d78a6.tar.gz rust-5a3a2d5a5ea80b04df3fd3406f2bd924763d78a6.zip | |
Auto merge of #3293 - rust-lang:rustup-2024-02-10, r=saethlin
Automatic Rustup
Diffstat (limited to 'compiler/rustc_parse/src/parser/expr.rs')
| -rw-r--r-- | compiler/rustc_parse/src/parser/expr.rs | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs index e36a648e203..1a57474bac2 100644 --- a/compiler/rustc_parse/src/parser/expr.rs +++ b/compiler/rustc_parse/src/parser/expr.rs @@ -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), |
