fork/rust

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

borsAuto merge of #67350 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum73528e339aa

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