fork/rust

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

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

master
2.4 KiB63 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:9: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   |     |
13   |     required by a bound introduced by this call
14   |
15note: required by a bound in `accept_fn_mut`
16  --> $DIR/move-ref-patterns-closure-captures.rs:4:31
17   |
18LL |     fn accept_fn_mut(_: &impl FnMut()) {}
19   |                               ^^^^^^^ required by this bound in `accept_fn_mut`
20
21error[E0525]: expected a closure that implements the `Fn` trait, but this closure only implements `FnOnce`
22  --> $DIR/move-ref-patterns-closure-captures.rs:9:14
23   |
24LL |     let c1 = || {
25   |              ^^ this closure implements `FnOnce`, not `Fn`
26...
27LL |         drop::<U>(_x1);
28   |                   --- closure is `FnOnce` because it moves the variable `_x1` out of its environment
29...
30LL |     accept_fn(&c1);
31   |     --------- --- the requirement to implement `Fn` derives from here
32   |     |
33   |     required by a bound introduced by this call
34   |
35note: required by a bound in `accept_fn`
36  --> $DIR/move-ref-patterns-closure-captures.rs:5:27
37   |
38LL |     fn accept_fn(_: &impl Fn()) {}
39   |                           ^^^^ required by this bound in `accept_fn`
40
41error[E0525]: expected a closure that implements the `Fn` trait, but this closure only implements `FnMut`
42  --> $DIR/move-ref-patterns-closure-captures.rs:20:14
43   |
44LL |     let c2 = || {
45   |              ^^ this closure implements `FnMut`, not `Fn`
46...
47LL |         drop::<&mut U>(_x2);
48   |                        --- closure is `FnMut` because it mutates the variable `_x2` here
49...
50LL |     accept_fn(&c2);
51   |     --------- --- the requirement to implement `Fn` derives from here
52   |     |
53   |     required by a bound introduced by this call
54   |
55note: required by a bound in `accept_fn`
56  --> $DIR/move-ref-patterns-closure-captures.rs:5:27
57   |
58LL |     fn accept_fn(_: &impl Fn()) {}
59   |                           ^^^^ required by this bound in `accept_fn`
60
61error: aborting due to 3 previous errors
62
63For more information about this error, try `rustc --explain E0525`.