mirror of
https://github.com/pezkuwichain/serde.git
synced 2026-06-14 08:11:02 +00:00
Add tests validating Serialize derivation for packed structs.
This commit is contained in:
committed by
David Tolnay
parent
8ff11dc234
commit
d5e6436b28
@@ -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,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user