2020-06-12 17:25:14 +00:00
|
|
|
fn main() {}
|
|
|
|
|
2021-07-10 09:33:42 +00:00
|
|
|
// fine
|
2020-06-12 17:25:14 +00:00
|
|
|
const Z: i32 = unsafe { *(&1 as *const i32) };
|
2021-07-10 09:33:42 +00:00
|
|
|
|
|
|
|
// bad, will thus error in miri
|
2021-07-12 22:21:35 +00:00
|
|
|
const Z2: i32 = unsafe { *(42 as *const i32) }; //~ ERROR evaluation of constant value failed
|
2022-07-03 19:46:22 +00:00
|
|
|
//~| is a dangling pointer
|
2021-07-12 22:21:35 +00:00
|
|
|
const Z3: i32 = unsafe { *(44 as *const i32) }; //~ ERROR evaluation of constant value failed
|
2022-07-03 19:46:22 +00:00
|
|
|
//~| is a dangling pointer
|