]> git.proxmox.com Git - rustc.git/blob - src/test/ui/issues/issue-21600.stderr
New upstream version 1.60.0+dfsg1
[rustc.git] / src / test / ui / issues / issue-21600.stderr
1 error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure
2 --> $DIR/issue-21600.rs:14:20
3 |
4 LL | fn call_it<F>(f: F) where F: Fn() { f(); }
5 | - change this to accept `FnMut` instead of `Fn`
6 ...
7 LL | call_it(|| x.gen_mut());
8 | ------- ^^^^^^^^^^^ cannot borrow as mutable
9 | |
10 | expects `Fn` instead of `FnMut`
11
12 error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure
13 --> $DIR/issue-21600.rs:14:17
14 |
15 LL | fn call_it<F>(f: F) where F: Fn() { f(); }
16 | - change this to accept `FnMut` instead of `Fn`
17 ...
18 LL | call_it(|| {
19 | _____-------_-
20 | | |
21 | | expects `Fn` instead of `FnMut`
22 LL | | call_it(|| x.gen());
23 LL | | call_it(|| x.gen_mut());
24 | | ^^ - mutable borrow occurs due to use of `x` in closure
25 | | |
26 | | cannot borrow as mutable
27 LL | |
28 LL | |
29 LL | | });
30 | |_____- in this closure
31
32 error: aborting due to 2 previous errors
33
34 For more information about this error, try `rustc --explain E0596`.