2018-08-01 14:40:06 -05:00
|
|
|
error[E0382]: use of moved value: `x`
|
2018-12-25 09:56:47 -06:00
|
|
|
--> $DIR/closure-move-spans.rs:7:13
|
2018-08-01 14:40:06 -05:00
|
|
|
|
|
2019-01-02 18:43:08 -06:00
|
|
|
LL | fn move_after_move(x: String) {
|
|
|
|
| - move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
|
2018-08-01 14:40:06 -05:00
|
|
|
LL | || x;
|
|
|
|
| -- - variable moved due to use in closure
|
|
|
|
| |
|
|
|
|
| value moved into closure here
|
|
|
|
LL | let y = x; //~ ERROR
|
|
|
|
| ^ value used here after move
|
|
|
|
|
|
|
|
error[E0382]: borrow of moved value: `x`
|
2018-12-25 09:56:47 -06:00
|
|
|
--> $DIR/closure-move-spans.rs:12:13
|
2018-08-01 14:40:06 -05:00
|
|
|
|
|
2019-01-02 18:43:08 -06:00
|
|
|
LL | fn borrow_after_move(x: String) {
|
|
|
|
| - move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
|
2018-08-01 14:40:06 -05:00
|
|
|
LL | || x;
|
|
|
|
| -- - variable moved due to use in closure
|
|
|
|
| |
|
|
|
|
| value moved into closure here
|
|
|
|
LL | let y = &x; //~ ERROR
|
|
|
|
| ^^ value borrowed here after move
|
|
|
|
|
|
|
|
error[E0382]: borrow of moved value: `x`
|
2018-12-25 09:56:47 -06:00
|
|
|
--> $DIR/closure-move-spans.rs:17:13
|
2018-08-01 14:40:06 -05:00
|
|
|
|
|
2019-01-02 18:43:08 -06:00
|
|
|
LL | fn borrow_mut_after_move(mut x: String) {
|
|
|
|
| ----- move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
|
2018-08-01 14:40:06 -05:00
|
|
|
LL | || x;
|
|
|
|
| -- - variable moved due to use in closure
|
|
|
|
| |
|
|
|
|
| value moved into closure here
|
|
|
|
LL | let y = &mut x; //~ ERROR
|
|
|
|
| ^^^^^^ value borrowed here after move
|
|
|
|
|
|
|
|
error: aborting due to 3 previous errors
|
|
|
|
|
|
|
|
For more information about this error, try `rustc --explain E0382`.
|