]> git.lizzy.rs Git - rust.git/blob - tests/ui/borrowck/borrow-raw-address-of-deref-mutability.rs
Rollup merge of #106726 - cmorin6:fix-comment-typos, r=Nilstrieb
[rust.git] / tests / ui / borrowck / borrow-raw-address-of-deref-mutability.rs
1 // Check that `&raw mut` cannot be used to turn a `&T` into a `*mut T`.
2
3 #![feature(raw_ref_op)]
4
5 fn raw_reborrow() {
6     let x = &0;
7
8     let q = &raw mut *x;                //~ ERROR cannot borrow
9 }
10
11 unsafe fn raw_reborrow_of_raw() {
12     let x = &0 as *const i32;
13
14     let q = &raw mut *x;                //~ ERROR cannot borrow
15 }
16
17 fn main() {}