about summary refs log tree commit diff
path: root/compiler/rustc_parse/src/parser/path.rs
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2024-01-22 02:29:21 +0000
committerMichael Goulet <michael@errs.io>2024-08-26 18:30:15 -0400
commitc61f85b6dd47343abe6383ea2eb71f0b3a7d0e2b (patch)
tree1a0c10f605a002b63fb577d0270300ede670a01c /compiler/rustc_parse/src/parser/path.rs
parent22572d0994593197593e2a1b7b18d720a9a349a7 (diff)
downloadrust-c61f85b6dd47343abe6383ea2eb71f0b3a7d0e2b.tar.gz
rust-c61f85b6dd47343abe6383ea2eb71f0b3a7d0e2b.zip
Don't make pattern nonterminals match statement nonterminals
Diffstat (limited to 'compiler/rustc_parse/src/parser/path.rs')
-rw-r--r--compiler/rustc_parse/src/parser/path.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/compiler/rustc_parse/src/parser/path.rs b/compiler/rustc_parse/src/parser/path.rs
index d8bf10e6021..8ee40ecd77e 100644
--- a/compiler/rustc_parse/src/parser/path.rs
+++ b/compiler/rustc_parse/src/parser/path.rs
@@ -378,7 +378,10 @@ impl<'a> Parser<'a> {
                     if self.may_recover()
                         && prev_token_before_parsing == token::PathSep
                         && (style == PathStyle::Expr && self.token.can_begin_expr()
-                            || style == PathStyle::Pat && self.token.can_begin_pattern())
+                            || style == PathStyle::Pat
+                                && self.token.can_begin_pattern(token::NtPatKind::PatParam {
+                                    inferred: false,
+                                }))
                     {
                         snapshot = Some(self.create_snapshot_for_diagnostic());
                     }