2017-09-16 04:39:51 -05:00
|
|
|
// This should fail even without validation
|
2018-10-24 10:17:44 -05:00
|
|
|
// compile-flags: -Zmiri-disable-validation
|
2017-07-12 02:29:18 -05:00
|
|
|
|
|
|
|
fn main() {
|
|
|
|
#[cfg(target_pointer_width="64")]
|
|
|
|
let bad = unsafe {
|
2018-08-14 10:19:46 -05:00
|
|
|
std::mem::transmute::<&[u8], [u8; 16]>(&[1u8])
|
2017-07-12 02:29:18 -05:00
|
|
|
};
|
|
|
|
#[cfg(target_pointer_width="32")]
|
|
|
|
let bad = unsafe {
|
2018-08-14 10:19:46 -05:00
|
|
|
std::mem::transmute::<&[u8], [u8; 8]>(&[1u8])
|
2017-07-12 02:29:18 -05:00
|
|
|
};
|
2018-11-26 08:31:53 -06:00
|
|
|
let _val = bad[0] + bad[bad.len()-1]; //~ ERROR a raw memory access tried to access part of a pointer value as raw bytes
|
2017-07-12 02:29:18 -05:00
|
|
|
}
|