2021-07-18 05:47:04 -05:00
|
|
|
// Test what happens when we read parts of a pointer.
|
|
|
|
// Related to <https://github.com/rust-lang/rust/issues/69488>.
|
2017-06-04 12:43:31 -05: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
|
2020-03-19 02:41:01 -05:00
|
|
|
let _val = unsafe { *z }; //~ ERROR unable to turn pointer into raw bytes
|
2017-06-04 12:43:31 -05:00
|
|
|
}
|