rust/tests/ui/issues/issue-21600.stderr

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

32 lines
1.1 KiB
Plaintext
Raw Normal View History

error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure
--> $DIR/issue-21600.rs:14:20
|
LL | fn call_it<F>(f: F) where F: Fn() { f(); }
| - change this to accept `FnMut` instead of `Fn`
...
LL | call_it(|| x.gen_mut());
| ------- -- ^ cannot borrow as mutable
2022-06-27 05:33:19 +00:00
| | |
| | in this closure
| expects `Fn` instead of `FnMut`
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
|
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`
...
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
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0596`.