]> git.lizzy.rs Git - rust.git/blob - src/test/ui/coercion/coerce-overloaded-autoderef.mir.stderr
Auto merge of #54624 - arielb1:evaluate-outlives, r=nikomatsakis
[rust.git] / src / test / ui / coercion / coerce-overloaded-autoderef.mir.stderr
1 error[E0499]: cannot borrow `*x` as mutable more than once at a time
2   --> $DIR/coerce-overloaded-autoderef.rs:22: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 ...
9 LL |     drop((y, z));
10    |           - borrow later used here
11
12 error[E0506]: cannot assign to `**x` because it is borrowed
13   --> $DIR/coerce-overloaded-autoderef.rs:31: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 ...
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.rs:38:20
26    |
27 LL |     borrow_mut2(x, x);
28    |     ---------------^-
29    |     |           |  |
30    |     |           |  second mutable borrow occurs here
31    |     |           first mutable borrow occurs here
32    |     borrow later used here
33
34 error[E0502]: cannot borrow `*x` as immutable because it is also borrowed as mutable
35   --> $DIR/coerce-overloaded-autoderef.rs:44:16
36    |
37 LL |     borrow2(x, x);
38    |     -----------^-
39    |     |       |  |
40    |     |       |  immutable borrow occurs here
41    |     |       mutable borrow occurs here
42    |     borrow later used here
43
44 error: aborting due to 4 previous errors
45
46 Some errors occurred: E0499, E0502, E0506.
47 For more information about an error, try `rustc --explain E0499`.