fork/rust

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

borsAuto merge of #66089 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum4560ea788cb

1.39.0
876 B28 linesraw
1error[E0503]: cannot use `p` because it was mutably borrowed
2  --> $DIR/borrowck-loan-rcvr-overloaded-op.rs:38:5
3   |
4LL |     let q = &mut p;
5   |             ------ borrow of `p` occurs here
6LL | 
7LL |     p + 3;
8   |     ^ use of borrowed `p`
9...
10LL |     *q + 3; // OK to use the new alias `q`
11   |     -- borrow later used here
12
13error[E0502]: cannot borrow `p` as immutable because it is also borrowed as mutable
14  --> $DIR/borrowck-loan-rcvr-overloaded-op.rs:39:5
15   |
16LL |     let q = &mut p;
17   |             ------ mutable borrow occurs here
18...
19LL |     p.times(3);
20   |     ^ immutable borrow occurs here
21LL | 
22LL |     *q + 3; // OK to use the new alias `q`
23   |     -- mutable borrow later used here
24
25error: aborting due to 2 previous errors
26
27Some errors have detailed explanations: E0502, E0503.
28For more information about an error, try `rustc --explain E0502`.