fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #67350 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum73528e339aa

1.40.0
1.7 KiB35 linesraw
1error[E0507]: cannot move out of `x`, a captured variable in an `Fn` closure
2  --> $DIR/unboxed-closure-illegal-move.rs:15:31
3   |
4LL |         let x = Box::new(0);
5   |             - captured outer variable
6LL |         let f = to_fn(|| drop(x));
7   |                               ^ move occurs because `x` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait
8
9error[E0507]: cannot move out of `x`, a captured variable in an `FnMut` closure
10  --> $DIR/unboxed-closure-illegal-move.rs:19:35
11   |
12LL |         let x = Box::new(0);
13   |             - captured outer variable
14LL |         let f = to_fn_mut(|| drop(x));
15   |                                   ^ move occurs because `x` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait
16
17error[E0507]: cannot move out of `x`, a captured variable in an `Fn` closure
18  --> $DIR/unboxed-closure-illegal-move.rs:28:36
19   |
20LL |         let x = Box::new(0);
21   |             - captured outer variable
22LL |         let f = to_fn(move || drop(x));
23   |                                    ^ move occurs because `x` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait
24
25error[E0507]: cannot move out of `x`, a captured variable in an `FnMut` closure
26  --> $DIR/unboxed-closure-illegal-move.rs:32:40
27   |
28LL |         let x = Box::new(0);
29   |             - captured outer variable
30LL |         let f = to_fn_mut(move || drop(x));
31   |                                        ^ move occurs because `x` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait
32
33error: aborting due to 4 previous errors
34
35For more information about this error, try `rustc --explain E0507`.