fork/rust

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

borsAuto merge of #72883 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum49cae55760d

1.44.0
1.3 KiB40 linesraw
1error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable
2  --> $DIR/borrow-raw-address-of-borrowed.rs:7:13
3   |
4LL |     let y = &x;
5   |             -- immutable borrow occurs here
6LL | 
7LL |     let q = &raw mut x;
8   |             ^^^^^^^^^^ mutable borrow occurs here
9LL | 
10LL |     drop(y);
11   |          - immutable borrow later used here
12
13error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable
14  --> $DIR/borrow-raw-address-of-borrowed.rs:16:13
15   |
16LL |     let y = &mut x;
17   |             ------ mutable borrow occurs here
18LL | 
19LL |     let p = &raw const x;
20   |             ^^^^^^^^^^^^ immutable borrow occurs here
21...
22LL |     drop(y);
23   |          - mutable borrow later used here
24
25error[E0499]: cannot borrow `x` as mutable more than once at a time
26  --> $DIR/borrow-raw-address-of-borrowed.rs:17:13
27   |
28LL |     let y = &mut x;
29   |             ------ first mutable borrow occurs here
30...
31LL |     let q = &raw mut x;
32   |             ^^^^^^^^^^ second mutable borrow occurs here
33LL | 
34LL |     drop(y);
35   |          - first borrow later used here
36
37error: aborting due to 3 previous errors
38
39Some errors have detailed explanations: E0499, E0502.
40For more information about an error, try `rustc --explain E0499`.