Allow range-to-inclusive macro patterns#158836
Conversation
|
r? @folkertdev rustbot has assigned @folkertdev. Use Why was this reviewer chosen?The reviewer was selected based on:
|
c413d1d to
72c1568
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
|
r? @nnethercote Looks fine but it's macro parsing to there might be something subtle I'm missing |
|
|
||
| /// Returns `true` if the token can appear at the start of a pattern. | ||
| /// | ||
| /// Shamelessly borrowed from `can_begin_expr`, only used for diagnostics right now. |
There was a problem hiding this comment.
I think the "only used for diagnostics" is not true; can_begin_pattern is used in both nonterminal_may_begin_with and parse_pat_with_range_pat which affect code parsing.
There was a problem hiding this comment.
this was added only for diagnostic.
the parse_pat_with_range_pat invocation is also emitting error:
rust/compiler/rustc_parse/src/parser/pat.rs
Lines 734 to 744 in bcd9ae8
the nonterminal_may_begin_with is indeed expand its usage, with a comment here:
https://github.com/rust-lang/rust/pull/120221/changes#r1669391427
and
#120221 (comment)
|
The change you've made is the obvious fix, but I'm uncertain about whether we can just accept the PR, or if we need some extra verification (e.g. crater run, or lang team involvement). @petrochenkov, what do you think? |
|
Any changes to I probably wouldn't bother running crater for this specific change, unless it's rolled up with something else or as a part of beta run. |
Fixes #120737