]> git.lizzy.rs Git - rust.git/blob - src/test/ui/span/borrowck-call-is-borrow-issue-12224.stderr
Rollup merge of #59856 - albins:update-polonius, r=nikomatsakis
[rust.git] / src / test / ui / span / borrowck-call-is-borrow-issue-12224.stderr
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
3    |
4 LL |     f(Box::new(|| {
5    |     -          ^^ second mutable borrow occurs here
6    |     |
7    |     first mutable borrow occurs here
8 LL |
9 LL |         f((Box::new(|| {})))
10    |         - borrow occurs due to use of `f` in closure
11 LL |     }));
12    |       - first borrow ends here
13
14 error[E0596]: cannot borrow immutable borrowed content `*f` as mutable
15   --> $DIR/borrowck-call-is-borrow-issue-12224.rs:25:5
16    |
17 LL | fn test2<F>(f: &F) where F: FnMut() {
18    |                -- use `&mut F` here to make mutable
19 LL |     (*f)();
20    |     ^^^^ cannot borrow as mutable
21
22 error[E0596]: cannot borrow field `f.f` of immutable binding as mutable
23   --> $DIR/borrowck-call-is-borrow-issue-12224.rs:34:5
24    |
25 LL | fn test4(f: &Test) {
26    |             ----- use `&mut Test` here to make mutable
27 LL |     f.f.call_mut(())
28    |     ^^^ cannot mutably borrow field of immutable binding
29
30 error[E0504]: cannot move `f` into closure because it is borrowed
31   --> $DIR/borrowck-call-is-borrow-issue-12224.rs:56:13
32    |
33 LL |     f(Box::new(|a| {
34    |     - borrow of `f` occurs here
35 LL |         foo(f);
36    |             ^ move into closure occurs here
37
38 error[E0507]: cannot move out of captured outer variable in an `FnMut` closure
39   --> $DIR/borrowck-call-is-borrow-issue-12224.rs:56:13
40    |
41 LL |     let mut f = move |g: Box<FnMut(isize)>, b: isize| {
42    |         ----- captured outer variable
43 ...
44 LL |         foo(f);
45    |             ^ cannot move out of captured outer variable in an `FnMut` closure
46
47 error: aborting due to 5 previous errors
48
49 Some errors occurred: E0499, E0504, E0507, E0596.
50 For more information about an error, try `rustc --explain E0499`.