2019-04-22 07:40:08 +00:00
|
|
|
error[E0505]: cannot move out of `x1` because it is borrowed
|
|
|
|
--> $DIR/borrowck-multiple-captures.rs:12:19
|
2018-08-08 12:28:26 +00:00
|
|
|
|
|
2023-01-15 03:06:44 +00:00
|
|
|
LL | let x1: Box<_> = Box::new(1);
|
|
|
|
| -- binding `x1` declared here
|
2018-08-08 12:28:26 +00:00
|
|
|
LL | let p1 = &x1;
|
2019-04-22 07:40:08 +00:00
|
|
|
| --- borrow of `x1` occurs here
|
|
|
|
...
|
|
|
|
LL | thread::spawn(move|| {
|
|
|
|
| ^^^^^^ move out of `x1` occurs here
|
2018-08-08 12:28:26 +00:00
|
|
|
...
|
2019-03-09 12:03:44 +00:00
|
|
|
LL | drop(x1);
|
2019-04-22 07:40:08 +00:00
|
|
|
| -- move occurs due to use in closure
|
|
|
|
...
|
|
|
|
LL | borrow(&*p1);
|
|
|
|
| ---- borrow later used here
|
2018-08-08 12:28:26 +00:00
|
|
|
|
2019-04-22 07:40:08 +00:00
|
|
|
error[E0505]: cannot move out of `x2` because it is borrowed
|
|
|
|
--> $DIR/borrowck-multiple-captures.rs:12:19
|
2018-08-08 12:28:26 +00:00
|
|
|
|
|
2023-01-15 03:06:44 +00:00
|
|
|
LL | let x2: Box<_> = Box::new(2);
|
|
|
|
| -- binding `x2` declared here
|
2018-08-08 12:28:26 +00:00
|
|
|
LL | let p2 = &x2;
|
2019-04-22 07:40:08 +00:00
|
|
|
| --- borrow of `x2` occurs here
|
|
|
|
LL | thread::spawn(move|| {
|
|
|
|
| ^^^^^^ move out of `x2` occurs here
|
2018-08-08 12:28:26 +00:00
|
|
|
...
|
2019-03-09 12:03:44 +00:00
|
|
|
LL | drop(x2);
|
2019-04-22 07:40:08 +00:00
|
|
|
| -- move occurs due to use in closure
|
|
|
|
...
|
|
|
|
LL | borrow(&*p2);
|
|
|
|
| ---- borrow later used here
|
2018-08-08 12:28:26 +00:00
|
|
|
|
2019-04-22 07:40:08 +00:00
|
|
|
error[E0382]: use of moved value: `x1`
|
|
|
|
--> $DIR/borrowck-multiple-captures.rs:27:19
|
2018-08-08 12:28:26 +00:00
|
|
|
|
|
2021-08-25 00:39:40 +00:00
|
|
|
LL | let x1: Box<_> = Box::new(1);
|
2020-09-02 07:40:56 +00:00
|
|
|
| -- move occurs because `x1` has type `Box<i32>`, which does not implement the `Copy` trait
|
2018-08-08 12:28:26 +00:00
|
|
|
LL | drop(x1);
|
|
|
|
| -- value moved here
|
|
|
|
...
|
2019-04-22 07:40:08 +00:00
|
|
|
LL | thread::spawn(move|| {
|
|
|
|
| ^^^^^^ value used here after move
|
|
|
|
...
|
2019-03-09 12:03:44 +00:00
|
|
|
LL | drop(x1);
|
2019-04-22 07:40:08 +00:00
|
|
|
| -- use occurs due to use in closure
|
2022-11-03 04:22:24 +00:00
|
|
|
|
|
|
|
|
help: consider cloning the value if the performance cost is acceptable
|
|
|
|
|
|
|
|
|
LL | drop(x1.clone());
|
|
|
|
| ++++++++
|
2018-08-08 12:28:26 +00:00
|
|
|
|
2019-04-22 07:40:08 +00:00
|
|
|
error[E0382]: use of moved value: `x2`
|
|
|
|
--> $DIR/borrowck-multiple-captures.rs:27:19
|
2018-08-08 12:28:26 +00:00
|
|
|
|
|
2021-08-25 00:39:40 +00:00
|
|
|
LL | let x2: Box<_> = Box::new(2);
|
2020-09-02 07:40:56 +00:00
|
|
|
| -- move occurs because `x2` has type `Box<i32>`, which does not implement the `Copy` trait
|
2018-08-08 12:28:26 +00:00
|
|
|
LL | drop(x2);
|
|
|
|
| -- value moved here
|
2019-04-22 07:40:08 +00:00
|
|
|
LL | thread::spawn(move|| {
|
|
|
|
| ^^^^^^ value used here after move
|
2018-08-08 12:28:26 +00:00
|
|
|
...
|
2019-03-09 12:03:44 +00:00
|
|
|
LL | drop(x2);
|
2019-04-22 07:40:08 +00:00
|
|
|
| -- use occurs due to use in closure
|
2022-11-03 04:22:24 +00:00
|
|
|
|
|
|
|
|
help: consider cloning the value if the performance cost is acceptable
|
|
|
|
|
|
|
|
|
LL | drop(x2.clone());
|
|
|
|
| ++++++++
|
2018-08-08 12:28:26 +00:00
|
|
|
|
|
|
|
error[E0382]: use of moved value: `x`
|
2019-04-22 07:40:08 +00:00
|
|
|
--> $DIR/borrowck-multiple-captures.rs:41:14
|
2018-08-08 12:28:26 +00:00
|
|
|
|
|
2019-03-09 12:03:44 +00:00
|
|
|
LL | drop(x);
|
2018-08-08 12:28:26 +00:00
|
|
|
| - value moved here
|
2019-03-09 12:03:44 +00:00
|
|
|
LL | drop(x);
|
2018-08-08 12:28:26 +00:00
|
|
|
| ^ value used here after move
|
|
|
|
|
|
2020-09-02 07:40:56 +00:00
|
|
|
= note: move occurs because `x` has type `Box<i32>`, which does not implement the `Copy` trait
|
2018-08-08 12:28:26 +00:00
|
|
|
|
2019-04-22 07:40:08 +00:00
|
|
|
error[E0505]: cannot move out of `x` because it is borrowed
|
|
|
|
--> $DIR/borrowck-multiple-captures.rs:38:19
|
2018-08-08 12:28:26 +00:00
|
|
|
|
|
2023-01-15 03:06:44 +00:00
|
|
|
LL | let x: Box<_> = Box::new(1);
|
|
|
|
| - binding `x` declared here
|
2019-04-22 07:40:08 +00:00
|
|
|
LL | let p = &x;
|
|
|
|
| -- borrow of `x` occurs here
|
2018-08-08 12:28:26 +00:00
|
|
|
LL | thread::spawn(move|| {
|
2019-04-22 07:40:08 +00:00
|
|
|
| ^^^^^^ move out of `x` occurs here
|
|
|
|
LL |
|
2019-03-09 12:03:44 +00:00
|
|
|
LL | drop(x);
|
2019-04-22 07:40:08 +00:00
|
|
|
| - move occurs due to use in closure
|
|
|
|
...
|
|
|
|
LL | borrow(&*p);
|
|
|
|
| --- borrow later used here
|
2018-08-08 12:28:26 +00:00
|
|
|
|
|
|
|
error[E0382]: use of moved value: `x`
|
2019-04-22 07:40:08 +00:00
|
|
|
--> $DIR/borrowck-multiple-captures.rs:52:14
|
2018-08-08 12:28:26 +00:00
|
|
|
|
|
2019-03-09 12:03:44 +00:00
|
|
|
LL | drop(x);
|
2018-08-08 12:28:26 +00:00
|
|
|
| - value moved here
|
2019-03-09 12:03:44 +00:00
|
|
|
LL | drop(x);
|
2018-08-08 12:28:26 +00:00
|
|
|
| ^ value used here after move
|
|
|
|
|
|
2020-09-02 07:40:56 +00:00
|
|
|
= note: move occurs because `x` has type `Box<i32>`, which does not implement the `Copy` trait
|
2018-08-08 12:28:26 +00:00
|
|
|
|
2019-04-22 07:40:08 +00:00
|
|
|
error[E0382]: use of moved value: `x`
|
|
|
|
--> $DIR/borrowck-multiple-captures.rs:49:19
|
|
|
|
|
|
2021-08-25 00:39:40 +00:00
|
|
|
LL | let x: Box<_> = Box::new(1);
|
2020-09-02 07:40:56 +00:00
|
|
|
| - move occurs because `x` has type `Box<i32>`, which does not implement the `Copy` trait
|
2019-04-22 07:40:08 +00:00
|
|
|
LL | drop(x);
|
|
|
|
| - value moved here
|
|
|
|
LL | thread::spawn(move|| {
|
|
|
|
| ^^^^^^ value used here after move
|
|
|
|
LL |
|
|
|
|
LL | drop(x);
|
|
|
|
| - use occurs due to use in closure
|
2022-11-03 04:22:24 +00:00
|
|
|
|
|
|
|
|
help: consider cloning the value if the performance cost is acceptable
|
|
|
|
|
|
|
|
|
LL | drop(x.clone());
|
|
|
|
| ++++++++
|
2019-04-22 07:40:08 +00:00
|
|
|
|
2018-08-08 12:28:26 +00:00
|
|
|
error: aborting due to 8 previous errors
|
|
|
|
|
2019-04-22 07:40:08 +00:00
|
|
|
Some errors have detailed explanations: E0382, E0505.
|
2018-08-08 12:28:26 +00:00
|
|
|
For more information about an error, try `rustc --explain E0382`.
|