Skip to content

Commit 354ec11

Browse files
committed
try using types with lower alignment, maybe that helps for Windows
1 parent 30cef4e commit 354ec11

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

tests/compile-fail/transmute_fat.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
fn main() {
55
#[cfg(target_pointer_width="64")]
66
let bad = unsafe {
7-
std::mem::transmute::<&[u8], u128>(&[1u8])
7+
std::mem::transmute::<&[u8], [u8; 16]>(&[1u8])
88
};
99
#[cfg(target_pointer_width="32")]
1010
let bad = unsafe {
11-
std::mem::transmute::<&[u8], u64>(&[1u8])
11+
std::mem::transmute::<&[u8], [u8; 8]>(&[1u8])
1212
};
13-
let _ = bad + 1; //~ ERROR constant evaluation error
13+
let _ = bad[0] + bad[bad.len()-1]; //~ ERROR constant evaluation error
1414
//~^ NOTE a raw memory access tried to access part of a pointer value as raw bytes
1515
}

0 commit comments

Comments
 (0)