fork/rust

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

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

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