2022-06-21 11:30:45 -05:00
|
|
|
#[cfg(target_pointer_width = "64")]
|
|
|
|
const N: usize = 16;
|
|
|
|
|
|
|
|
#[cfg(target_pointer_width = "32")]
|
|
|
|
const N: usize = 8;
|
2017-07-12 02:29:18 -05:00
|
|
|
|
|
|
|
fn main() {
|
2022-06-21 11:30:45 -05:00
|
|
|
let bad = unsafe {
|
|
|
|
std::mem::transmute::<&[u8], [u8; N]>(&[1u8])
|
2022-06-29 20:31:27 -05:00
|
|
|
//~^ ERROR: constructing invalid value: encountered a pointer
|
2022-06-21 11:30:45 -05:00
|
|
|
};
|
2022-06-21 13:27:44 -05:00
|
|
|
let _val = bad[0] + bad[bad.len() - 1];
|
2017-07-12 02:29:18 -05:00
|
|
|
}
|