rust/src/test/ui/borrowck/borrowck-multiple-captures.nll.stderr
2019-01-24 10:53:43 -08:00

104 lines
4.0 KiB
Plaintext

error[E0505]: cannot move out of `x1` because it is borrowed
--> $DIR/borrowck-multiple-captures.rs:12:19
|
LL | let p1 = &x1;
| --- borrow of `x1` occurs here
...
LL | thread::spawn(move|| {
| ^^^^^^ move out of `x1` occurs here
LL | drop(x1); //~ ERROR cannot move `x1` into closure because it is borrowed
| -- move occurs due to use in closure
...
LL | borrow(&*p1);
| ---- borrow later used here
error[E0505]: cannot move out of `x2` because it is borrowed
--> $DIR/borrowck-multiple-captures.rs:12:19
|
LL | let p2 = &x2;
| --- borrow of `x2` occurs here
LL | thread::spawn(move|| {
| ^^^^^^ move out of `x2` occurs here
LL | drop(x1); //~ ERROR cannot move `x1` into closure because it is borrowed
LL | drop(x2); //~ ERROR cannot move `x2` into closure because it is borrowed
| -- move occurs due to use in closure
...
LL | borrow(&*p2);
| ---- borrow later used here
error[E0382]: use of moved value: `x1`
--> $DIR/borrowck-multiple-captures.rs:25:19
|
LL | let x1: Box<_> = box 1;
| -- move occurs because `x1` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait
LL | drop(x1);
| -- value moved here
...
LL | thread::spawn(move|| {
| ^^^^^^ value used here after move
LL | drop(x1); //~ ERROR capture of moved value: `x1`
| -- use occurs due to use in closure
error[E0382]: use of moved value: `x2`
--> $DIR/borrowck-multiple-captures.rs:25:19
|
LL | let x2: Box<_> = box 2;
| -- move occurs because `x2` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait
LL | drop(x2);
| -- value moved here
LL | thread::spawn(move|| {
| ^^^^^^ value used here after move
LL | drop(x1); //~ ERROR capture of moved value: `x1`
LL | drop(x2); //~ ERROR capture of moved value: `x2`
| -- use occurs due to use in closure
error[E0382]: use of moved value: `x`
--> $DIR/borrowck-multiple-captures.rs:36:14
|
LL | drop(x); //~ ERROR cannot move `x` into closure because it is borrowed
| - value moved here
LL | drop(x); //~ ERROR use of moved value: `x`
| ^ value used here after move
|
= note: move occurs because `x` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait
error[E0505]: cannot move out of `x` because it is borrowed
--> $DIR/borrowck-multiple-captures.rs:34:19
|
LL | let p = &x;
| -- borrow of `x` occurs here
LL | thread::spawn(move|| {
| ^^^^^^ move out of `x` occurs here
LL | drop(x); //~ ERROR cannot move `x` into closure because it is borrowed
| - move occurs due to use in closure
...
LL | borrow(&*p);
| --- borrow later used here
error[E0382]: use of moved value: `x`
--> $DIR/borrowck-multiple-captures.rs:46:14
|
LL | drop(x); //~ ERROR capture of moved value: `x`
| - value moved here
LL | drop(x); //~ ERROR use of moved value: `x`
| ^ value used here after move
|
= note: move occurs because `x` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait
error[E0382]: use of moved value: `x`
--> $DIR/borrowck-multiple-captures.rs:44:19
|
LL | let x: Box<_> = box 1;
| - move occurs because `x` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait
LL | drop(x);
| - value moved here
LL | thread::spawn(move|| {
| ^^^^^^ value used here after move
LL | drop(x); //~ ERROR capture of moved value: `x`
| - use occurs due to use in closure
error: aborting due to 8 previous errors
Some errors occurred: E0382, E0505.
For more information about an error, try `rustc --explain E0382`.