fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #68568 - pietroalbini:stable-next, r=pietroalbini5e1a799842b

1.41.0
912 B26 linesraw
1error[E0502]: cannot borrow `*v` as immutable because it is also borrowed as mutable
2  --> $DIR/borrowck-lend-flow-loop.rs:29:16
3   |
4LL |     let mut x = &mut v;
5   |                 ------ mutable borrow occurs here
6LL |     for _ in 0..3 {
7LL |         borrow(&*v);
8   |                ^^^ immutable borrow occurs here
9LL |     }
10LL |     *x = box 5;
11   |     -- mutable borrow later used here
12
13error[E0502]: cannot borrow `*v` as immutable because it is also borrowed as mutable
14  --> $DIR/borrowck-lend-flow-loop.rs:92:16
15   |
16LL |         **x += 1;
17   |         -------- mutable borrow later used here
18LL |         borrow(&*v);
19   |                ^^^ immutable borrow occurs here
20LL |         if cond2 {
21LL |             x = &mut v; // OK
22   |                 ------ mutable borrow occurs here
23
24error: aborting due to 2 previous errors
25
26For more information about this error, try `rustc --explain E0502`.