fork/rust

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

borsAuto merge of #71365 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum4fb7144ed15

1.43.0
1017 B27 linesraw
1error[E0503]: cannot use `i` because it was mutably borrowed
2  --> $DIR/two-phase-allow-access-during-reservation.rs:30:19
3   |
4LL |     /*1*/ let p = &mut i; // (reservation of `i` starts here)
5   |                   ------ borrow of `i` occurs here
6LL | 
7LL |     /*2*/ let j = i;      // OK: `i` is only reserved here
8   |                   ^ use of borrowed `i`
9...
10LL |     /*3*/ *p += 1;        // (mutable borrow of `i` starts here, since `p` is used)
11   |           ------- borrow later used here
12
13error[E0503]: cannot use `i` because it was mutably borrowed
14  --> $DIR/two-phase-allow-access-during-reservation.rs:35:19
15   |
16LL |     /*1*/ let p = &mut i; // (reservation of `i` starts here)
17   |                   ------ borrow of `i` occurs here
18...
19LL |     /*4*/ let k = i;
20   |                   ^ use of borrowed `i`
21...
22LL |     /*5*/ *p += 1;
23   |           ------- borrow later used here
24
25error: aborting due to 2 previous errors
26
27For more information about this error, try `rustc --explain E0503`.