2021-07-10 04:33:42 -05:00
|
|
|
#![feature(const_raw_ptr_deref)]
|
2020-06-12 12:25:14 -05:00
|
|
|
|
|
|
|
fn main() {}
|
|
|
|
|
2021-07-10 04:33:42 -05:00
|
|
|
// fine
|
2020-06-12 12:25:14 -05:00
|
|
|
const Z: i32 = unsafe { *(&1 as *const i32) };
|
2021-07-10 04:33:42 -05:00
|
|
|
|
|
|
|
// bad, will thus error in miri
|
2020-06-12 12:25:14 -05:00
|
|
|
const Z2: i32 = unsafe { *(42 as *const i32) }; //~ ERROR any use of this value will cause
|
2021-01-30 07:49:22 -06:00
|
|
|
//~| WARN this was previously accepted by the compiler but is being phased out
|
2020-06-12 12:25:14 -05:00
|
|
|
const Z3: i32 = unsafe { *(44 as *const i32) }; //~ ERROR any use of this value will cause
|
2021-01-30 07:49:22 -06:00
|
|
|
//~| WARN this was previously accepted by the compiler but is being phased out
|