-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
or-patterns: enable :pat to match top_pat #78935
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
We could do a one token lookahead in |
Sorry could you elaborate? Do you mean that if a matcher has |
Yes, if the next token is "simply
No, |
Ok, so I've add Alternately, if we make |
The current implementation makes @petrochenkov Assuming CI passes this time, could you please enqueue a crater run? |
CI is passing :) |
@bors try |
⌛ Trying commit 2dbf53908d42f5182e3c7df27c6a894fa533679c with merge 5da6ef1a86b7737c978f534cbc5032d07b84936e... |
💔 Test failed - checks-actions |
@bors retry (not sure if I have permissions) |
@mark-i-m: 🔑 Insufficient privileges: not in try users |
@bors try |
⌛ Trying commit 68098dc with merge 961316100510fe780d266d35bcf68702fbb049e5... |
☀️ Try build successful - checks-actions |
👌 Experiment ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more |
🚧 Experiment ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more |
🎉 Experiment
|
Hmm... so these are the regressions:
I think one way to mitigate most of the regressions would be to change the rust parser to have a mode for parsing macros so that if it sees a trailing vert (i.e. The other regressions are hard to resolve, I think. |
Nah, this needs to be specifically implemented.
What do you mean by "trailing vert"? |
Anyway, at this point it probably makes sense to avoid smart compatibility conditions and just flip the switch at edition boundary, keeping the old behavior on 2015/2018. |
Yes, exactly this.
I agree. Do you want me to change the PR to implement that (or start a new PR)? Or should we nominate the issue for T-lang and wait for a discussion first? |
At your discretion. |
I am going to close this since we have the required data. It sounds like we will be pursuing some sort of edition-based transition for |
…matsakis Stabilize or_patterns (RFC 2535, 2530, 2175) closes rust-lang#54883 This PR stabilizes the or_patterns feature in Rust 1.53. This is blocked on the following (in order): - [x] The crater run in rust-lang#78935 (comment) - [x] The resolution of the unresolved questions and a second crater run (rust-lang#78935 (comment)) - It looks like we will need to pursue some sort of edition-based transition for `:pat`. - [x] Nomination and discussion by T-lang - [x] Implement new behavior for `:pat` based on consensus (rust-lang#80100). - [ ] An FCP on stabilization EDIT: Stabilization report is in rust-lang#79278 (comment)
Stabilize or_patterns (RFC 2535, 2530, 2175) closes #54883 This PR stabilizes the or_patterns feature in Rust 1.53. This is blocked on the following (in order): - [x] The crater run in rust-lang/rust#78935 (comment) - [x] The resolution of the unresolved questions and a second crater run (rust-lang/rust#78935 (comment)) - It looks like we will need to pursue some sort of edition-based transition for `:pat`. - [x] Nomination and discussion by T-lang - [x] Implement new behavior for `:pat` based on consensus (rust-lang/rust#80100). - [ ] An FCP on stabilization EDIT: Stabilization report is in rust-lang/rust#79278 (comment)
Allow :pat in macros to match a top-level or-pattern, as discussed in #54883 (comment)
I don't have a good way to run the test locally, so I've included a new UI test to make sure the PR does what I expect... if CI passes, please enqueue a (check-only?) crater run.r? @petrochenkov
cc #54883
EDIT: notably, this makes :pat match
top_pat
rather thanpat<no_top_alt>
, which was an open question in the RFC. This is a breaking change, so we will need to do a crater run and see how to proceed. If the breakage is too much, we may go with a compromise, as outlined in #78935 (comment)EDIT 2: this patch now implements petrochenkov's proposal in #78935 (comment)