2019-04-22 02:40:08 -05:00
|
|
|
error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure
|
|
|
|
--> $DIR/issue-21600.rs:14:20
|
|
|
|
|
|
2020-02-03 18:08:45 -06:00
|
|
|
LL | fn call_it<F>(f: F) where F: Fn() { f(); }
|
|
|
|
| - change this to accept `FnMut` instead of `Fn`
|
|
|
|
...
|
2019-04-22 02:40:08 -05:00
|
|
|
LL | call_it(|| x.gen_mut());
|
2022-06-27 00:33:19 -05:00
|
|
|
| ------- -- ^^^^^^^^^^^ cannot borrow as mutable
|
|
|
|
| | |
|
|
|
|
| | in this closure
|
2020-02-03 18:08:45 -06:00
|
|
|
| expects `Fn` instead of `FnMut`
|
2019-04-22 02:40:08 -05:00
|
|
|
|
|
|
|
error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure
|
2018-12-25 09:56:47 -06:00
|
|
|
--> $DIR/issue-21600.rs:14:17
|
2017-12-10 13:47:55 -06:00
|
|
|
|
|
2022-06-27 00:45:35 -05:00
|
|
|
LL | fn call_it<F>(f: F) where F: Fn() { f(); }
|
|
|
|
| - change this to accept `FnMut` instead of `Fn`
|
2020-02-03 18:08:45 -06:00
|
|
|
...
|
2022-06-27 00:45:35 -05:00
|
|
|
LL | call_it(|| {
|
2022-06-27 00:33:19 -05:00
|
|
|
| ------- -- in this closure
|
|
|
|
| |
|
|
|
|
| expects `Fn` instead of `FnMut`
|
2022-06-27 00:45:35 -05:00
|
|
|
LL | call_it(|| x.gen());
|
|
|
|
LL | call_it(|| x.gen_mut());
|
|
|
|
| ^^ - mutable borrow occurs due to use of `x` in closure
|
|
|
|
| |
|
|
|
|
| cannot borrow as mutable
|
2017-12-10 13:47:55 -06:00
|
|
|
|
|
|
|
error: aborting due to 2 previous errors
|
|
|
|
|
2019-04-22 02:40:08 -05:00
|
|
|
For more information about this error, try `rustc --explain E0596`.
|