1
Fork 0

Don't make pattern nonterminals match statement nonterminals

This commit is contained in:
Michael Goulet 2024-01-22 02:29:21 +00:00
parent 22572d0994
commit c61f85b6dd
5 changed files with 65 additions and 42 deletions

View file

@ -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());
}