2019-12-11 08:04:29 -06:00
|
|
|
error[E0507]: cannot move out of `var`, a captured variable in an `FnMut` closure
|
|
|
|
--> $DIR/option-content-move2.rs:9:9
|
|
|
|
|
|
2022-06-27 00:45:35 -05:00
|
|
|
LL | let mut var = None;
|
|
|
|
| ------- captured outer variable
|
|
|
|
LL | func(|| {
|
|
|
|
| -- captured by this `FnMut` closure
|
|
|
|
LL | // Shouldn't suggest `move ||.as_ref()` here
|
|
|
|
LL | move || {
|
2023-01-14 21:06:44 -06:00
|
|
|
| ^^^^^^^ `var` is moved here
|
2022-06-27 00:45:35 -05:00
|
|
|
LL |
|
|
|
|
LL | var = Some(NotCopyable);
|
|
|
|
| ---
|
|
|
|
| |
|
|
|
|
| variable moved due to use in closure
|
|
|
|
| move occurs because `var` has type `Option<NotCopyable>`, which does not implement the `Copy` trait
|
2019-12-11 08:04:29 -06:00
|
|
|
|
|
|
|
error: aborting due to previous error
|
|
|
|
|
|
|
|
For more information about this error, try `rustc --explain E0507`.
|