]> git.lizzy.rs Git - rust.git/blob - src/test/ui/borrowck/borrow-raw-address-of-deref-mutability.rs
Sync rust-lang/portable-simd@03f6fbb21e6050da2a05b3ce8f480c020b384916
[rust.git] / src / test / 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() {}