diff options
| author | Yuki Okushi <jtitor@2k36.org> | 2021-07-30 16:26:55 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-07-30 16:26:55 +0900 |
| commit | aaef1a16495092ca910128d1dd70bb169303e2a1 (patch) | |
| tree | 93761debb2f203f87f251abf1a90e52d4aeebccd /src/test | |
| parent | 7e4b1737ff3c054fb8a9893515ced938b5fe24ba (diff) | |
| parent | d380ed13043d52139b3c766a07edb93b891e2be6 (diff) | |
| download | rust-aaef1a16495092ca910128d1dd70bb169303e2a1.tar.gz rust-aaef1a16495092ca910128d1dd70bb169303e2a1.zip | |
Rollup merge of #87554 - sexxi-goose:fix-issue-87426, r=nikomatsakis
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 https://github.com/rust-lang/rust/issues/87426
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/ui/closures/2229_closure_analysis/issue-87426.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/test/ui/closures/2229_closure_analysis/issue-87426.rs b/src/test/ui/closures/2229_closure_analysis/issue-87426.rs new file mode 100644 index 00000000000..74506979a28 --- /dev/null +++ b/src/test/ui/closures/2229_closure_analysis/issue-87426.rs @@ -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(); +} |
