fork/rust

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

borsAuto merge of #72883 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum49cae55760d

1.44.0
1.6 KiB39 linesraw
1error[E0525]: expected a closure that implements the `FnMut` trait, but this closure only implements `FnOnce`
2  --> $DIR/move-ref-patterns-closure-captures.rs:11:14
3   |
4LL |     let c1 = || {
5   |              ^^ this closure implements `FnOnce`, not `FnMut`
6...
7LL |         drop::<U>(_x1);
8   |                   --- closure is `FnOnce` because it moves the variable `_x1` out of its environment
9...
10LL |     accept_fn_mut(&c1);
11   |     ------------- the requirement to implement `FnMut` derives from here
12
13error[E0525]: expected a closure that implements the `Fn` trait, but this closure only implements `FnOnce`
14  --> $DIR/move-ref-patterns-closure-captures.rs:11:14
15   |
16LL |     let c1 = || {
17   |              ^^ this closure implements `FnOnce`, not `Fn`
18...
19LL |         drop::<U>(_x1);
20   |                   --- closure is `FnOnce` because it moves the variable `_x1` out of its environment
21...
22LL |     accept_fn(&c1);
23   |     --------- the requirement to implement `Fn` derives from here
24
25error[E0525]: expected a closure that implements the `Fn` trait, but this closure only implements `FnMut`
26  --> $DIR/move-ref-patterns-closure-captures.rs:22:14
27   |
28LL |     let c2 = || {
29   |              ^^ this closure implements `FnMut`, not `Fn`
30...
31LL |         drop::<&mut U>(_x2);
32   |                        --- closure is `FnMut` because it mutates the variable `_x2` here
33...
34LL |     accept_fn(&c2);
35   |     --------- the requirement to implement `Fn` derives from here
36
37error: aborting due to 3 previous errors
38
39For more information about this error, try `rustc --explain E0525`.