forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
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 rust-lang#87554 - sexxi-goose:fix-issue-87426, r=niko…
…matsakis 2229: Discr should be read when PatKind is Range This PR fixes an issue related to pattern matching in closures when Edition 2021 is enabled. - If any of the patterns the discr is being matched on is `PatKind::Range` then the discr should be read r? ``@nikomatsakis`` Closes rust-lang#87426
- Loading branch information
Showing
2 changed files
with
26 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// run-pass | ||
// edition:2021 | ||
|
||
pub fn foo() { | ||
let ref_x_ck = 123; | ||
let _y = || match ref_x_ck { | ||
2_000_000..=3_999_999 => { println!("A")} | ||
_ => { println!("B")} | ||
}; | ||
} | ||
|
||
fn main() { | ||
foo(); | ||
} |