2018-08-01 20:40:06 +01:00
|
|
|
error[E0382]: use of moved value: `x`
|
2024-04-12 04:46:31 +00:00
|
|
|
--> $DIR/closure-move-spans.rs:7:13
|
2018-08-01 20:40:06 +01:00
|
|
|
|
|
2019-01-02 16:43:08 -08:00
|
|
|
LL | fn move_after_move(x: String) {
|
2020-09-02 10:40:56 +03:00
|
|
|
| - move occurs because `x` has type `String`, which does not implement the `Copy` trait
|
2018-08-01 20:40:06 +01:00
|
|
|
LL | || x;
|
|
|
|
| -- - variable moved due to use in closure
|
|
|
|
| |
|
|
|
|
| value moved into closure here
|
2019-03-09 15:03:44 +03:00
|
|
|
LL | let y = x;
|
2018-08-01 20:40:06 +01:00
|
|
|
| ^ value used here after move
|
2024-04-12 04:46:31 +00:00
|
|
|
|
|
|
|
|
help: consider cloning the value if the performance cost is acceptable
|
|
|
|
|
|
|
|
|
LL | || x.clone();
|
|
|
|
| ++++++++
|
2018-08-01 20:40:06 +01:00
|
|
|
|
|
|
|
error[E0382]: borrow of moved value: `x`
|
2024-04-12 04:46:31 +00:00
|
|
|
--> $DIR/closure-move-spans.rs:12:13
|
2018-08-01 20:40:06 +01:00
|
|
|
|
|
2019-01-02 16:43:08 -08:00
|
|
|
LL | fn borrow_after_move(x: String) {
|
2020-09-02 10:40:56 +03:00
|
|
|
| - move occurs because `x` has type `String`, which does not implement the `Copy` trait
|
2018-08-01 20:40:06 +01:00
|
|
|
LL | || x;
|
|
|
|
| -- - variable moved due to use in closure
|
|
|
|
| |
|
|
|
|
| value moved into closure here
|
2019-03-09 15:03:44 +03:00
|
|
|
LL | let y = &x;
|
2018-08-01 20:40:06 +01:00
|
|
|
| ^^ value borrowed here after move
|
2024-04-12 04:46:31 +00:00
|
|
|
|
|
|
|
|
help: consider cloning the value if the performance cost is acceptable
|
|
|
|
|
|
|
|
|
LL | || x.clone();
|
|
|
|
| ++++++++
|
2018-08-01 20:40:06 +01:00
|
|
|
|
|
|
|
error[E0382]: borrow of moved value: `x`
|
2024-04-12 04:46:31 +00:00
|
|
|
--> $DIR/closure-move-spans.rs:17:13
|
2018-08-01 20:40:06 +01:00
|
|
|
|
|
2019-01-02 16:43:08 -08:00
|
|
|
LL | fn borrow_mut_after_move(mut x: String) {
|
2020-09-02 10:40:56 +03:00
|
|
|
| ----- move occurs because `x` has type `String`, which does not implement the `Copy` trait
|
2018-08-01 20:40:06 +01:00
|
|
|
LL | || x;
|
|
|
|
| -- - variable moved due to use in closure
|
|
|
|
| |
|
|
|
|
| value moved into closure here
|
2019-03-09 15:03:44 +03:00
|
|
|
LL | let y = &mut x;
|
2018-08-01 20:40:06 +01:00
|
|
|
| ^^^^^^ value borrowed here after move
|
2024-04-12 04:46:31 +00:00
|
|
|
|
|
|
|
|
help: consider cloning the value if the performance cost is acceptable
|
|
|
|
|
|
|
|
|
LL | || x.clone();
|
|
|
|
| ++++++++
|
2018-08-01 20:40:06 +01:00
|
|
|
|
|
|
|
error: aborting due to 3 previous errors
|
|
|
|
|
|
|
|
For more information about this error, try `rustc --explain E0382`.
|