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
|
2021-07-12 17:21:35 -05:00
|
|
|
const Z2: i32 = unsafe { *(42 as *const i32) }; //~ ERROR evaluation of constant value failed
|
2022-07-03 14:46:22 -05:00
|
|
|
//~| is a dangling pointer
|
2021-07-12 17:21:35 -05:00
|
|
|
const Z3: i32 = unsafe { *(44 as *const i32) }; //~ ERROR evaluation of constant value failed
|
2022-07-03 14:46:22 -05:00
|
|
|
//~| is a dangling pointer
|