-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #85678 - lukas-code:matches2021, r=dtolnay
fix `matches!` and `assert_matches!` on edition 2021 Previously this code failed to compile on edition 2021. [(Playground)](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=53960f2f051f641777b9e458da747707) ```rust fn main() { matches!((), ()); } ``` ``` Compiling playground v0.0.1 (/playground) error: `$pattern:pat` may be followed by `|`, which is not allowed for `pat` fragments | = note: allowed there are: `=>`, `,`, `=`, `if` or `in` error: aborting due to previous error error: could not compile `playground` To learn more, run the command again with --verbose. ```
- Loading branch information
Showing
3 changed files
with
16 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// run-pass | ||
// edition:2021 | ||
// compile-flags: -Zunstable-options | ||
|
||
// regression test for https://github.com/rust-lang/rust/pull/85678 | ||
|
||
#![feature(assert_matches)] | ||
|
||
fn main() { | ||
assert!(matches!((), ())); | ||
assert_matches!((), ()); | ||
} |