Add tests validating Serialize derivation for packed structs.

This commit is contained in:
Tanner Rogalsky authored and David Tolnay committed 2020-06-21 16:46:27 -07:00
1 parent 8ff11dc234
commit d5e6436b28
1 file changed
+16
+16
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,
}
}