1 error[E0499]: cannot borrow `f` as mutable more than once at a time
2 --> $DIR/borrowck-call-is-borrow-issue-12224.rs:12:16
5 | - ^^ second mutable borrow occurs here
7 | first mutable borrow occurs here
8 | first borrow later used by call
10 LL | f((Box::new(|| {})))
11 | - second borrow occurs due to use of `f` in closure
13 error[E0596]: cannot borrow `*f` as mutable, as it is behind a `&` reference
14 --> $DIR/borrowck-call-is-borrow-issue-12224.rs:25:5
17 | ^^^^ `f` is a `&` reference, so the data it refers to cannot be borrowed as mutable
19 help: consider changing this to be a mutable reference
21 LL | fn test2<F>(f: &mut F) where F: FnMut() {
24 error[E0596]: cannot borrow `f.f` as mutable, as it is behind a `&` reference
25 --> $DIR/borrowck-call-is-borrow-issue-12224.rs:34:5
28 | ^^^^^^^^^^^^^^^^ `f` is a `&` reference, so the data it refers to cannot be borrowed as mutable
30 help: consider changing this to be a mutable reference
32 LL | fn test4(f: &mut Test<'_>) {
35 error[E0507]: cannot move out of `f`, a captured variable in an `FnMut` closure
36 --> $DIR/borrowck-call-is-borrow-issue-12224.rs:57:13
38 LL | let mut f = move |g: Box<dyn FnMut(isize)>, b: isize| {
39 | ----- captured outer variable
42 | --- captured by this `FnMut` closure
45 | ^ move occurs because `f` has type `[closure@$DIR/borrowck-call-is-borrow-issue-12224.rs:52:17: 52:58]`, which does not implement the `Copy` trait
47 error[E0505]: cannot move out of `f` because it is borrowed
48 --> $DIR/borrowck-call-is-borrow-issue-12224.rs:55:16
51 | - ^^^ move out of `f` occurs here
53 | borrow of `f` occurs here
56 | - move occurs due to use in closure
58 error: aborting due to 5 previous errors
60 Some errors have detailed explanations: E0499, E0505, E0507, E0596.
61 For more information about an error, try `rustc --explain E0499`.