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