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