]> git.lizzy.rs Git - rust.git/blob - tests/ui/borrowck/borrow-raw-address-of-deref-mutability.stderr
Rollup merge of #106726 - cmorin6:fix-comment-typos, r=Nilstrieb
[rust.git] / tests / ui / borrowck / borrow-raw-address-of-deref-mutability.stderr
1 error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference
2   --> $DIR/borrow-raw-address-of-deref-mutability.rs:8:13
3    |
4 LL |     let q = &raw mut *x;
5    |             ^^^^^^^^^^^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable
6    |
7 help: consider changing this to be a mutable reference
8    |
9 LL |     let x = &mut 0;
10    |             ~~~~~~
11
12 error[E0596]: cannot borrow `*x` as mutable, as it is behind a `*const` pointer
13   --> $DIR/borrow-raw-address-of-deref-mutability.rs:14:13
14    |
15 LL |     let q = &raw mut *x;
16    |             ^^^^^^^^^^^ `x` is a `*const` pointer, so the data it refers to cannot be borrowed as mutable
17    |
18 help: consider changing this to be a mutable pointer
19    |
20 LL |     let x = &mut 0 as *const i32;
21    |             ~~~~~~
22
23 error: aborting due to 2 previous errors
24
25 For more information about this error, try `rustc --explain E0596`.