2017-09-16 04:39:51 -05:00
|
|
|
// This should fail even without validation
|
|
|
|
// compile-flags: -Zmir-emit-validate=0
|
2017-07-12 02:29:18 -05:00
|
|
|
|
|
|
|
fn main() {
|
|
|
|
#[cfg(target_pointer_width="64")]
|
|
|
|
let bad = unsafe {
|
|
|
|
std::mem::transmute::<&[u8], u128>(&[1u8])
|
|
|
|
};
|
|
|
|
#[cfg(target_pointer_width="32")]
|
|
|
|
let bad = unsafe {
|
|
|
|
std::mem::transmute::<&[u8], u64>(&[1u8])
|
|
|
|
};
|
2018-07-15 04:21:56 -05:00
|
|
|
let _ = bad + 1; //~ 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-07-12 02:29:18 -05:00
|
|
|
}
|