2017-06-22 17:47:09 -07:00
|
|
|
fn main() {
|
|
|
|
let x = &1;
|
|
|
|
// Casting down to u8 and back up to a pointer loses too much precision; this must not work.
|
2017-06-22 18:41:10 -07:00
|
|
|
let x = x as *const i32;
|
2018-10-19 11:50:17 +02:00
|
|
|
let x = x as u8; //~ ERROR a raw memory access tried to access part of a pointer value as raw bytes
|
2017-06-22 18:41:10 -07:00
|
|
|
let x = x as *const i32;
|
2018-11-26 15:31:53 +01:00
|
|
|
let _val = unsafe { *x };
|
2017-06-22 17:47:09 -07:00
|
|
|
}
|