fork/rust

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

borsAuto merge of #67350 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum73528e339aa

1.40.0
1.1 KiB35 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 |         call_it(|| x.gen_mut());
5   |                    ^ cannot borrow as mutable
6   |
7help: consider changing this to accept closures that implement `FnMut`
8  --> $DIR/issue-21600.rs:14:17
9   |
10LL |         call_it(|| x.gen_mut());
11   |                 ^^^^^^^^^^^^^^
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 |         call_it(|| x.gen_mut());
17   |                 ^^ - mutable borrow occurs due to use of `x` in closure
18   |                 |
19   |                 cannot borrow as mutable
20   |
21help: consider changing this to accept closures that implement `FnMut`
22  --> $DIR/issue-21600.rs:12:13
23   |
24LL |       call_it(|| {
25   |  _____________^
26LL | |         call_it(|| x.gen());
27LL | |         call_it(|| x.gen_mut());
28LL | |
29LL | |
30LL | |     });
31   | |_____^
32
33error: aborting due to 2 previous errors
34
35For more information about this error, try `rustc --explain E0596`.