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