Add tests validating Serialize derivation for packed structs.

This commit is contained in:
Tanner Rogalsky 2020-05-17 12:14:30 -04:00 committed by David Tolnay
parent 8ff11dc234
commit d5e6436b28

View File

@ -1878,3 +1878,19 @@ fn test_internally_tagged_newtype_variant_containing_unit_struct() {
],
);
}
#[deny(safe_packed_borrows)]
#[test]
fn test_packed_struct_can_derive_serialize() {
#[derive(Copy, Clone, Serialize)]
#[repr(packed, C)]
struct PackedC {
t: f32,
}
#[derive(Copy, Clone, Serialize)]
#[repr(C, packed)]
struct CPacked {
t: f32,
}
}