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