]> git.lizzy.rs Git - rust.git/blob - src/test/ui/borrowck/borrowck-lend-flow-loop.nll.stderr
Auto merge of #54624 - arielb1:evaluate-outlives, r=nikomatsakis
[rust.git] / src / test / ui / borrowck / borrowck-lend-flow-loop.nll.stderr
1 error[E0502]: cannot borrow `*v` as immutable because it is also borrowed as mutable
2   --> $DIR/borrowck-lend-flow-loop.rs:45:16
3    |
4 LL |     let mut x = &mut v;
5    |                 ------ mutable borrow occurs here
6 LL |     for _ in 0..3 {
7 LL |         borrow(&*v); //~ ERROR cannot borrow
8    |                ^^^ immutable borrow occurs here
9 LL |     }
10 LL |     *x = box 5;
11    |     -- borrow used here, in later iteration of loop
12
13 error[E0502]: cannot borrow `*v` as immutable because it is also borrowed as mutable
14   --> $DIR/borrowck-lend-flow-loop.rs:109:16
15    |
16 LL |         **x += 1;
17    |         -------- borrow used here, in later iteration of loop
18 LL |         borrow(&*v); //~ ERROR cannot borrow
19    |                ^^^ immutable borrow occurs here
20 LL |         if cond2 {
21 LL |             x = &mut v; //~ ERROR cannot borrow
22    |                 ------ mutable borrow occurs here
23
24 error: aborting due to 2 previous errors
25
26 For more information about this error, try `rustc --explain E0502`.