2019-05-05 11:02:32 +00:00
|
|
|
error[E0507]: cannot move out of `x.0`, as `x` is a captured variable in an `Fn` closure
|
2019-04-07 15:07:36 +00:00
|
|
|
--> $DIR/issue-52663-span-decl-captured-variable.rs:8:26
|
2018-08-07 17:50:19 +00:00
|
|
|
|
|
|
|
|
LL | let x = (vec![22], vec![44]);
|
|
|
|
| - captured outer variable
|
|
|
|
LL | expect_fn(|| drop(x.0));
|
2022-06-27 05:45:35 +00:00
|
|
|
| -- ^^^ move occurs because `x.0` has type `Vec<i32>`, which does not implement the `Copy` trait
|
|
|
|
| |
|
2021-07-25 18:05:41 +00:00
|
|
|
| captured by this `Fn` closure
|
2024-03-13 03:41:41 +00:00
|
|
|
|
|
|
|
|
help: consider cloning the value if the performance cost is acceptable
|
|
|
|
|
|
|
|
|
LL | expect_fn(|| drop(x.0.clone()));
|
|
|
|
| ++++++++
|
2018-08-07 17:50:19 +00:00
|
|
|
|
2023-11-21 15:44:16 +00:00
|
|
|
error: aborting due to 1 previous error
|
2018-08-07 17:50:19 +00:00
|
|
|
|
|
|
|
For more information about this error, try `rustc --explain E0507`.
|