fork/rust

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

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

master
1.1 KiB31 linesraw
1error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure
2  --> $DIR/issue-21600.rs:14:20
3   |
4LL | fn call_it<F>(f: F) where F: Fn() { f(); }
5   |                  - change this to accept `FnMut` instead of `Fn`
6...
7LL |         call_it(|| x.gen_mut());
8   |         ------- -- ^ cannot borrow as mutable
9   |         |       |
10   |         |       in this closure
11   |         expects `Fn` instead of `FnMut`
12
13error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure
14  --> $DIR/issue-21600.rs:14:17
15   |
16LL | fn call_it<F>(f: F) where F: Fn() { f(); }
17   |                  - change this to accept `FnMut` instead of `Fn`
18...
19LL |     call_it(|| {
20   |     ------- -- in this closure
21   |     |
22   |     expects `Fn` instead of `FnMut`
23LL |         call_it(|| x.gen());
24LL |         call_it(|| x.gen_mut());
25   |                 ^^ - mutable borrow occurs due to use of `x` in closure
26   |                 |
27   |                 cannot borrow as mutable
28
29error: aborting due to 2 previous errors
30
31For more information about this error, try `rustc --explain E0596`.