2022-11-13 13:53:35 -06:00
|
|
|
error[E0382]: borrow of moved value: `b`
|
|
|
|
--> $DIR/closure.rs:27:5
|
2020-05-27 00:05:09 -05:00
|
|
|
|
|
2022-11-13 13:53:35 -06:00
|
|
|
LL | let mut c = b;
|
|
|
|
| - value moved here
|
|
|
|
...
|
2020-05-27 00:05:09 -05:00
|
|
|
LL | b();
|
2022-11-13 13:53:35 -06:00
|
|
|
| ^ value borrowed here after move
|
2022-07-30 00:37:48 -05:00
|
|
|
|
|
2022-11-13 13:53:35 -06:00
|
|
|
note: closure cannot be moved more than once as it is not `Copy` due to moving the variable `a` out of its environment
|
|
|
|
--> $DIR/closure.rs:20:9
|
2020-05-27 00:05:09 -05:00
|
|
|
|
|
2022-11-13 13:53:35 -06:00
|
|
|
LL | a = 1;
|
|
|
|
| ^
|
|
|
|
help: consider mutably borrowing `b`
|
2022-03-28 21:30:39 -05:00
|
|
|
|
|
2022-11-13 13:53:35 -06:00
|
|
|
LL | let mut c = &mut b;
|
|
|
|
| ++++
|
2020-05-27 00:05:09 -05:00
|
|
|
|
2022-11-13 13:53:35 -06:00
|
|
|
error: aborting due to previous error
|
2020-05-27 00:05:09 -05:00
|
|
|
|
2022-11-13 13:53:35 -06:00
|
|
|
For more information about this error, try `rustc --explain E0382`.
|