]> git.lizzy.rs Git - rust.git/blob - src/test/ui/unboxed-closures/unboxed-closure-illegal-move.stderr
Rollup merge of #86828 - lambinoo:67441-const-fn-copied-take-replace, r=joshtriplett
[rust.git] / src / test / ui / unboxed-closures / unboxed-closure-illegal-move.stderr
1 error[E0507]: cannot move out of `x`, a captured variable in an `Fn` closure
2   --> $DIR/unboxed-closure-illegal-move.rs:15:31
3    |
4 LL |         let x = Box::new(0);
5    |             - captured outer variable
6 LL |         let f = to_fn(|| drop(x));
7    |                       --------^-
8    |                       |       |
9    |                       |       move occurs because `x` has type `Box<i32>`, which does not implement the `Copy` trait
10    |                       captured by this `Fn` closure
11
12 error[E0507]: cannot move out of `x`, a captured variable in an `FnMut` closure
13   --> $DIR/unboxed-closure-illegal-move.rs:19:35
14    |
15 LL |         let x = Box::new(0);
16    |             - captured outer variable
17 LL |         let f = to_fn_mut(|| drop(x));
18    |                           --------^-
19    |                           |       |
20    |                           |       move occurs because `x` has type `Box<i32>`, which does not implement the `Copy` trait
21    |                           captured by this `FnMut` closure
22
23 error[E0507]: cannot move out of `x`, a captured variable in an `Fn` closure
24   --> $DIR/unboxed-closure-illegal-move.rs:28:36
25    |
26 LL |         let x = Box::new(0);
27    |             - captured outer variable
28 LL |         let f = to_fn(move || drop(x));
29    |                       -------------^-
30    |                       |            |
31    |                       |            move occurs because `x` has type `Box<i32>`, which does not implement the `Copy` trait
32    |                       captured by this `Fn` closure
33
34 error[E0507]: cannot move out of `x`, a captured variable in an `FnMut` closure
35   --> $DIR/unboxed-closure-illegal-move.rs:32:40
36    |
37 LL |         let x = Box::new(0);
38    |             - captured outer variable
39 LL |         let f = to_fn_mut(move || drop(x));
40    |                           -------------^-
41    |                           |            |
42    |                           |            move occurs because `x` has type `Box<i32>`, which does not implement the `Copy` trait
43    |                           captured by this `FnMut` closure
44
45 error: aborting due to 4 previous errors
46
47 For more information about this error, try `rustc --explain E0507`.