2017-06-04 10:43:31 -07:00
|
|
|
fn main() {
|
|
|
|
let x = 13;
|
|
|
|
let y = &x;
|
|
|
|
let z = &y as *const &i32 as *const u8;
|
|
|
|
// the deref fails, because we are reading only a part of the pointer
|
2018-07-15 11:21:56 +02:00
|
|
|
let _ = unsafe { *z }; //~ ERROR constant evaluation error
|
2018-05-09 17:45:16 +02:00
|
|
|
//~^ NOTE tried to access part of a pointer value as raw bytes
|
2017-06-04 10:43:31 -07:00
|
|
|
}
|