diff options
| author | Roxane <roxane.fruytier@hotmail.com> | 2021-08-28 19:54:12 -0400 |
|---|---|---|
| committer | Roxane <roxane.fruytier@hotmail.com> | 2021-08-28 19:54:12 -0400 |
| commit | 33817d2881843bb84a01551813c522891ce0c5c6 (patch) | |
| tree | 5b19e17d37922fca027c49a0bc5d1ebd6e44b001 | |
| parent | f7b0e3b441af1def0845ce6c52273d7fcf4aa2a3 (diff) | |
| download | rust-33817d2881843bb84a01551813c522891ce0c5c6.tar.gz rust-33817d2881843bb84a01551813c522891ce0c5c6.zip | |
Move match tests in match folder
| -rw-r--r-- | src/test/ui/closures/2229_closure_analysis/match/issue-87988.rs (renamed from src/test/ui/closures/2229_closure_analysis/issue-87988.rs) | 0 | ||||
| -rw-r--r-- | src/test/ui/closures/2229_closure_analysis/match/issue-88331.rs (renamed from src/test/ui/closures/2229_closure_analysis/issue-88331.rs) | 0 | ||||
| -rw-r--r-- | src/test/ui/closures/2229_closure_analysis/match/issue-88331.stderr (renamed from src/test/ui/closures/2229_closure_analysis/issue-88331.stderr) | 0 | ||||
| -rw-r--r-- | src/test/ui/closures/2229_closure_analysis/match/match-edge-cases_1.rs (renamed from src/test/ui/closures/2229_closure_analysis/match/match-edge-cases.rs) | 34 | ||||
| -rw-r--r-- | src/test/ui/closures/2229_closure_analysis/match/match-edge-cases_2.rs | 37 | ||||
| -rw-r--r-- | src/test/ui/closures/2229_closure_analysis/match/match-edge-cases_2.stderr (renamed from src/test/ui/closures/2229_closure_analysis/match/match-edge-cases.stderr) | 2 |
6 files changed, 38 insertions, 35 deletions
diff --git a/src/test/ui/closures/2229_closure_analysis/issue-87988.rs b/src/test/ui/closures/2229_closure_analysis/match/issue-87988.rs index 27e7fabf11a..27e7fabf11a 100644 --- a/src/test/ui/closures/2229_closure_analysis/issue-87988.rs +++ b/src/test/ui/closures/2229_closure_analysis/match/issue-87988.rs diff --git a/src/test/ui/closures/2229_closure_analysis/issue-88331.rs b/src/test/ui/closures/2229_closure_analysis/match/issue-88331.rs index 0a6d71c68ae..0a6d71c68ae 100644 --- a/src/test/ui/closures/2229_closure_analysis/issue-88331.rs +++ b/src/test/ui/closures/2229_closure_analysis/match/issue-88331.rs diff --git a/src/test/ui/closures/2229_closure_analysis/issue-88331.stderr b/src/test/ui/closures/2229_closure_analysis/match/issue-88331.stderr index f02d23464f1..f02d23464f1 100644 --- a/src/test/ui/closures/2229_closure_analysis/issue-88331.stderr +++ b/src/test/ui/closures/2229_closure_analysis/match/issue-88331.stderr diff --git a/src/test/ui/closures/2229_closure_analysis/match/match-edge-cases.rs b/src/test/ui/closures/2229_closure_analysis/match/match-edge-cases_1.rs index f5330b07445..914ebbe26a5 100644 --- a/src/test/ui/closures/2229_closure_analysis/match/match-edge-cases.rs +++ b/src/test/ui/closures/2229_closure_analysis/match/match-edge-cases_1.rs @@ -41,38 +41,4 @@ pub fn edge_case_char(event: char) { }; } -enum SingleVariant { - A -} - -struct TestStruct { - x: i32, - y: i32, - z: i32, -} - -fn edge_case_if() { - let sv = SingleVariant::A; - let condition = true; - // sv should not be captured as it is a SingleVariant - let _a = || { - match sv { - SingleVariant::A if condition => (), - _ => () - } - }; - let mut mut_sv = sv; - _a(); - - // ts should be captured - let ts = TestStruct { x: 1, y: 1, z: 1 }; - let _b = || { match ts { - TestStruct{ x: 1, .. } => (), - _ => () - }}; - let mut mut_ts = ts; - //~^ ERROR: cannot move out of `ts` because it is borrowed - _b(); -} - fn main() {} diff --git a/src/test/ui/closures/2229_closure_analysis/match/match-edge-cases_2.rs b/src/test/ui/closures/2229_closure_analysis/match/match-edge-cases_2.rs new file mode 100644 index 00000000000..ae724f9c3cc --- /dev/null +++ b/src/test/ui/closures/2229_closure_analysis/match/match-edge-cases_2.rs @@ -0,0 +1,37 @@ +// edition:2021 + +enum SingleVariant { + A +} + +struct TestStruct { + x: i32, + y: i32, + z: i32, +} + +fn edge_case_if() { + let sv = SingleVariant::A; + let condition = true; + // sv should not be captured as it is a SingleVariant + let _a = || { + match sv { + SingleVariant::A if condition => (), + _ => () + } + }; + let mut mut_sv = sv; + _a(); + + // ts should be captured + let ts = TestStruct { x: 1, y: 1, z: 1 }; + let _b = || { match ts { + TestStruct{ x: 1, .. } => (), + _ => () + }}; + let mut mut_ts = ts; + //~^ ERROR: cannot move out of `ts` because it is borrowed + _b(); +} + +fn main() {} diff --git a/src/test/ui/closures/2229_closure_analysis/match/match-edge-cases.stderr b/src/test/ui/closures/2229_closure_analysis/match/match-edge-cases_2.stderr index b9d2316206e..1e42d73c62b 100644 --- a/src/test/ui/closures/2229_closure_analysis/match/match-edge-cases.stderr +++ b/src/test/ui/closures/2229_closure_analysis/match/match-edge-cases_2.stderr @@ -1,5 +1,5 @@ error[E0505]: cannot move out of `ts` because it is borrowed - --> $DIR/match-edge-cases.rs:32:22 + --> $DIR/match-edge-cases_2.rs:32:22 | LL | let _b = || { match ts { | -- -- borrow occurs due to use in closure |
