]> git.lizzy.rs Git - rust.git/blob - tests/ui/borrowck/borrowck-lend-flow-loop.stderr
Rollup merge of #106644 - alexcrichton:update-wasi-toolchain, r=cuviper
[rust.git] / tests / ui / borrowck / borrowck-lend-flow-loop.stderr
1 error[E0502]: cannot borrow `*v` as immutable because it is also borrowed as mutable
2   --> $DIR/borrowck-lend-flow-loop.rs:29:16
3    |
4 LL |     let mut x = &mut v;
5    |                 ------ mutable borrow occurs here
6 LL |     for _ in 0..3 {
7 LL |         borrow(&*v);
8    |                ^^^ immutable borrow occurs here
9 LL |     }
10 LL |     *x = Box::new(5);
11    |     -- mutable borrow later used here
12
13 error[E0502]: cannot borrow `*v` as immutable because it is also borrowed as mutable
14   --> $DIR/borrowck-lend-flow-loop.rs:92:16
15    |
16 LL |         **x += 1;
17    |         -------- mutable borrow later used here
18 LL |         borrow(&*v);
19    |                ^^^ immutable borrow occurs here
20 LL |         if cond2 {
21 LL |             x = &mut v; // OK
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`.