diff options
| author | bors <bors@rust-lang.org> | 2023-12-12 07:09:19 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-12-12 07:09:19 +0000 |
| commit | fda521a988749458326ecef2e92e979077727a4e (patch) | |
| tree | 73ec9f26b38eb86b5676735f79e577c12fe0024a /compiler/rustc_parse/src/parser/expr.rs | |
| parent | aaeb4dd3a93a6be4cba5eb173f35453803994773 (diff) | |
| parent | 03b7ed06c88ae869daa4f2a30ef341918cc76ac7 (diff) | |
| download | rust-fda521a988749458326ecef2e92e979077727a4e.tar.gz rust-fda521a988749458326ecef2e92e979077727a4e.zip | |
Auto merge of #3223 - rust-lang:rustup-2023-12-12, r=RalfJung
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, 10 insertions, 2 deletions
diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs index 406a6def019..5b0011e9f70 100644 --- a/compiler/rustc_parse/src/parser/expr.rs +++ b/compiler/rustc_parse/src/parser/expr.rs @@ -2276,7 +2276,7 @@ impl<'a> Parser<'a> { } if self.token.kind == TokenKind::Semi - && matches!(self.token_cursor.stack.last(), Some((_, Delimiter::Parenthesis, _))) + && matches!(self.token_cursor.stack.last(), Some((.., Delimiter::Parenthesis))) && self.may_recover() { // It is likely that the closure body is a block but where the @@ -2918,7 +2918,15 @@ impl<'a> Parser<'a> { let mut result = if !is_fat_arrow && !is_almost_fat_arrow { // A pattern without a body, allowed for never patterns. arm_body = None; - this.expect_one_of(&[token::Comma], &[token::CloseDelim(Delimiter::Brace)]) + this.expect_one_of(&[token::Comma], &[token::CloseDelim(Delimiter::Brace)]).map( + |x| { + // Don't gate twice + if !pat.contains_never_pattern() { + this.sess.gated_spans.gate(sym::never_patterns, pat.span); + } + x + }, + ) } else { if let Err(mut err) = this.expect(&token::FatArrow) { // We might have a `=>` -> `=` or `->` typo (issue #89396). |
