We have to use u16 to test field reordering because u64's alignment changes based on 32-bit or 64-bit architecture.

This commit is contained in:
Austin Hicks 2017-03-20 14:07:46 -04:00 committed by Simonas Kazlauskas
parent 8b00837691
commit 98eb121b7a

View File

@ -33,13 +33,13 @@ enum e3 {
struct ReorderedStruct {
a: u8,
b: u64,
b: u16,
c: u8
}
enum ReorderedEnum {
A(u8, u64, u8),
B(u8, u64, u8),
A(u8, u16, u8),
B(u8, u16, u8),
}
pub fn main() {
@ -65,6 +65,6 @@ pub fn main() {
assert_eq!(size_of::<e1>(), 8 as usize);
assert_eq!(size_of::<e2>(), 8 as usize);
assert_eq!(size_of::<e3>(), 4 as usize);
assert_eq!(size_of::<ReorderedStruct>(), 16);
assert_eq!(size_of::<ReorderedEnum>(), 16);
assert_eq!(size_of::<ReorderedStruct>(), 4);
assert_eq!(size_of::<ReorderedEnum>(), 6);
}