]> git.lizzy.rs Git - rust.git/blob - tests/ui/coercion/coerce-overloaded-autoderef-fail.stderr
Port pgo.sh to Python
[rust.git] / tests / ui / coercion / coerce-overloaded-autoderef-fail.stderr
1 error[E0499]: cannot borrow `*x` as mutable more than once at a time
2   --> $DIR/coerce-overloaded-autoderef-fail.rs:9:24
3    |
4 LL |     let y = borrow_mut(x);
5    |                        - first mutable borrow occurs here
6 LL |     let z = borrow_mut(x);
7    |                        ^ second mutable borrow occurs here
8 LL |
9 LL |     drop((y, z));
10    |           - first borrow later used here
11
12 error[E0506]: cannot assign to `**x` because it is borrowed
13   --> $DIR/coerce-overloaded-autoderef-fail.rs:17:5
14    |
15 LL |     let y = borrow(x);
16    |                    - borrow of `**x` occurs here
17 LL |     let z = borrow(x);
18 LL |     **x += 1;
19    |     ^^^^^^^^ assignment to borrowed `**x` occurs here
20 LL |
21 LL |     drop((y, z));
22    |           - borrow later used here
23
24 error[E0499]: cannot borrow `*x` as mutable more than once at a time
25   --> $DIR/coerce-overloaded-autoderef-fail.rs:23:20
26    |
27 LL |     borrow_mut2(x, x);
28    |     ----------- -  ^ second mutable borrow occurs here
29    |     |           |
30    |     |           first mutable borrow occurs here
31    |     first borrow later used by call
32
33 error[E0502]: cannot borrow `*x` as mutable because it is also borrowed as immutable
34   --> $DIR/coerce-overloaded-autoderef-fail.rs:28:5
35    |
36 LL |     borrow2(x, x);
37    |     -------^^^^-^
38    |     |          |
39    |     |          immutable borrow occurs here
40    |     mutable borrow occurs here
41    |     immutable borrow later used by call
42
43 error: aborting due to 4 previous errors
44
45 Some errors have detailed explanations: E0499, E0502, E0506.
46 For more information about an error, try `rustc --explain E0499`.