about summary refs log tree commit diff
path: root/compiler/rustc_parse/src/parser/expr.rs
diff options
context:
space:
mode:
authorNadrieril <nadrieril+git@gmail.com>2023-12-12 13:33:39 +0100
committerNadrieril <nadrieril+git@gmail.com>2023-12-12 14:42:04 +0100
commite274372689928972e4e78a24d615f6c4d375f7d4 (patch)
tree714874e1b0e365fd84bb3d2d86edc2ebb986ae76 /compiler/rustc_parse/src/parser/expr.rs
parent21cce21d8c012f14cf74d5afddd795d324600dac (diff)
downloadrust-e274372689928972e4e78a24d615f6c4d375f7d4.tar.gz
rust-e274372689928972e4e78a24d615f6c4d375f7d4.zip
Correctly gate the parsing of match arms without body
Diffstat (limited to 'compiler/rustc_parse/src/parser/expr.rs')
-rw-r--r--compiler/rustc_parse/src/parser/expr.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs
index 3c0627526be..bdaf8db1311 100644
--- a/compiler/rustc_parse/src/parser/expr.rs
+++ b/compiler/rustc_parse/src/parser/expr.rs
@@ -2918,7 +2918,12 @@ 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| {
+                        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).