2017-06-22 19:47:09 -05: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 20:41:10 -05:00
|
|
|
let x = x as *const i32;
|
2018-07-15 04:21:56 -05:00
|
|
|
let x = x as u8; //~ ERROR constant evaluation error
|
2018-05-09 10:45:16 -05:00
|
|
|
//~^ NOTE a raw memory access tried to access part of a pointer value as raw bytes
|
2017-06-22 20:41:10 -05:00
|
|
|
let x = x as *const i32;
|
2017-06-22 19:47:09 -05:00
|
|
|
let _ = unsafe { *x };
|
|
|
|
}
|