diff options
author | Felix S. Klock II <pnkfelix@pnkfx.org> | 2018-05-09 17:17:58 +0200 |
---|---|---|
committer | Felix S. Klock II <pnkfelix@pnkfx.org> | 2018-05-29 23:02:40 +0200 |
commit | 5c30dc85c23d23482148f5eb0485320bc1abc2a3 (patch) | |
tree | dc9b830bba07df0fa69eb6d4bec2c44f840e6833 | |
parent | rust-lang/rust#27282: emit `ReadForMatch` on each match arm. (diff) | |
download | grust-5c30dc85c23d23482148f5eb0485320bc1abc2a3.tar.gz grust-5c30dc85c23d23482148f5eb0485320bc1abc2a3.tar.bz2 grust-5c30dc85c23d23482148f5eb0485320bc1abc2a3.tar.xz |
rust-lang/rust#41962 has a new error with my new code. Incorporate that into my code.
In particular, I am adding an implicit injected borrow on the pattern
matches, and when we go around the loop, the compiler is reporting
that this injected borrow is conflicting with the move of the original
value when the match succeeds.
-rw-r--r-- | src/test/ui/borrowck/issue-41962.rs | 5 | ||||
-rw-r--r-- | src/test/ui/borrowck/issue-41962.stderr | 19 |
2 files changed, 16 insertions, 8 deletions
diff --git a/src/test/ui/borrowck/issue-41962.rs b/src/test/ui/borrowck/issue-41962.rs index f7c33691ad..29481dbe52 100644 --- a/src/test/ui/borrowck/issue-41962.rs +++ b/src/test/ui/borrowck/issue-41962.rs | |||
@@ -15,11 +15,12 @@ pub fn main(){ | |||
15 | 15 | ||
16 | loop { | 16 | loop { |
17 | if let Some(thing) = maybe { | 17 | if let Some(thing) = maybe { |
18 | //~^ ERROR use of partially moved value: `maybe` (Ast) [E0382] | 18 | } |
19 | //~^^ ERROR use of partially moved value: `maybe` (Ast) [E0382] | ||
19 | //~| ERROR use of moved value: `(maybe as std::prelude::v1::Some).0` (Ast) [E0382] | 20 | //~| ERROR use of moved value: `(maybe as std::prelude::v1::Some).0` (Ast) [E0382] |
20 | //~| ERROR use of moved value: `maybe` (Mir) [E0382] | 21 | //~| ERROR use of moved value: `maybe` (Mir) [E0382] |
21 | //~| ERROR use of moved value: `maybe` (Mir) [E0382] | 22 | //~| ERROR use of moved value: `maybe` (Mir) [E0382] |
22 | //~| ERROR use of moved value: `maybe.0` (Mir) [E0382] | 23 | //~| ERROR use of moved value: `maybe.0` (Mir) [E0382] |
23 | } | 24 | //~| ERROR borrow of moved value: `maybe` (Mir) [E0382] |
24 | } | 25 | } |
25 | } | 26 | } |
diff --git a/src/test/ui/borrowck/issue-41962.stderr b/src/test/ui/borrowck/issue-41962.stderr index 39525d787b..e6eb3739d8 100644 --- a/src/test/ui/borrowck/issue-41962.stderr +++ b/src/test/ui/borrowck/issue-41962.stderr | |||
@@ -23,16 +23,23 @@ LL | if let Some(thing) = maybe { | |||
23 | | ^ ----- value moved here | 23 | | ^ ----- value moved here |
24 | | _________| | 24 | | _________| |
25 | | | | 25 | | | |
26 | LL | | //~^ ERROR use of partially moved value: `maybe` (Ast) [E0382] | ||
27 | LL | | //~| ERROR use of moved value: `(maybe as std::prelude::v1::Some).0` (Ast) [E0382] | ||
28 | LL | | //~| ERROR use of moved value: `maybe` (Mir) [E0382] | ||
29 | LL | | //~| ERROR use of moved value: `maybe` (Mir) [E0382] | ||
30 | LL | | //~| ERROR use of moved value: `maybe.0` (Mir) [E0382] | ||
31 | LL | | } | 26 | LL | | } |
32 | | |_________^ value used here after move | 27 | | |_________^ value used here after move |
33 | | | 28 | | |
34 | = note: move occurs because `maybe` has type `std::option::Option<std::vec::Vec<bool>>`, which does not implement the `Copy` trait | 29 | = note: move occurs because `maybe` has type `std::option::Option<std::vec::Vec<bool>>`, which does not implement the `Copy` trait |
35 | 30 | ||
31 | error[E0382]: borrow of moved value: `maybe` (Mir) | ||
32 | --> $DIR/issue-41962.rs:17:9 | ||
33 | | | ||
34 | LL | if let Some(thing) = maybe { | ||
35 | | ^ ----- value moved here | ||
36 | | _________| | ||
37 | | | | ||
38 | LL | | } | ||
39 | | |_________^ value borrowed here after move | ||
40 | | | ||
41 | = note: move occurs because `maybe` has type `std::option::Option<std::vec::Vec<bool>>`, which does not implement the `Copy` trait | ||
42 | |||
36 | error[E0382]: use of moved value: `maybe` (Mir) | 43 | error[E0382]: use of moved value: `maybe` (Mir) |
37 | --> $DIR/issue-41962.rs:17:16 | 44 | --> $DIR/issue-41962.rs:17:16 |
38 | | | 45 | | |
@@ -52,6 +59,6 @@ LL | if let Some(thing) = maybe { | |||
52 | | | 59 | | |
53 | = note: move occurs because `maybe.0` has type `std::vec::Vec<bool>`, which does not implement the `Copy` trait | 60 | = note: move occurs because `maybe.0` has type `std::vec::Vec<bool>`, which does not implement the `Copy` trait |
54 | 61 | ||
55 | error: aborting due to 5 previous errors | 62 | error: aborting due to 6 previous errors |
56 | 63 | ||
57 | For more information about this error, try `rustc --explain E0382`. | 64 | For more information about this error, try `rustc --explain E0382`. |