never patterns: Document behavior of never patterns with macros-by-example#119622
Merged
bors merged 1 commit intorust-lang:masterfrom Jan 5, 2024
Merged
never patterns: Document behavior of never patterns with macros-by-example#119622bors merged 1 commit intorust-lang:masterfrom
bors merged 1 commit intorust-lang:masterfrom
Conversation
compiler-errors
approved these changes
Jan 5, 2024
| } | ||
|
|
||
| macro_rules! detect_pat { | ||
| ($p:pat) => { |
Contributor
There was a problem hiding this comment.
Wait, weren't the pat macro metavar matchers adjusted for editions >= 2021? Please make an //edition:2021 version of this test.
Member
Author
There was a problem hiding this comment.
Oh shoot well spotted that does have a different behavior. Still backwards-compatible, but a bit inconsistent :/
Member
Author
There was a problem hiding this comment.
Yup, I checked on the playground, this is backwards-compatible. And in fact the assymetry of ! | true vs true | ! in edition 2021 can't be changed
30b4242 to
49bc67f
Compare
34 tasks
49bc67f to
d9e47be
Compare
This comment has been minimized.
This comment has been minimized.
d9e47be to
718a433
Compare
Member
Author
|
@bors r=compiler-errors |
Collaborator
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Jan 5, 2024
…iaskrgr Rollup of 8 pull requests Successful merges: - rust-lang#119151 (Hide foreign `#[doc(hidden)]` paths in import suggestions) - rust-lang#119350 (Imply outlives-bounds on lazy type aliases) - rust-lang#119354 (Make `negative_bounds` internal & fix some of its issues) - rust-lang#119506 (Use `resolutions(()).effective_visiblities` to avoid cycle errors in `report_object_error`) - rust-lang#119554 (Fix scoping for let chains in match guards) - rust-lang#119563 (Check yield terminator's resume type in borrowck) - rust-lang#119589 (cstore: Remove unnecessary locking from `CrateMetadata`) - rust-lang#119622 (never patterns: Document behavior of never patterns with macros-by-example) r? `@ghost` `@rustbot` modify labels: rollup
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Jan 5, 2024
Rollup merge of rust-lang#119622 - Nadrieril:never_patterns_macros, r=compiler-errors never patterns: Document behavior of never patterns with macros-by-example `never_patterns` makes `!` parse as a pattern so I was worried about breaking macros-by-example matching. Turns out we're fine because the cases that now match `$p:pat` used to error in the past. The only tricky case is `!` by itself, which backwards-compatibly doesn't match `$p:pat`. I have no idea why tho, I didn't think of that when I was implementing parsing 😅. This adds tests so we don't regress the current behavior. r? `@compiler-errors`
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
never_patternsmakes!parse as a pattern so I was worried about breaking macros-by-example matching. Turns out we're fine because the cases that now match$p:patused to error in the past. The only tricky case is!by itself, which backwards-compatibly doesn't match$p:pat. I have no idea why tho, I didn't think of that when I was implementing parsing 😅.This adds tests so we don't regress the current behavior.
r? @compiler-errors