Skip to content

Commit

Permalink
Add tests validating Serialize derivation for packed structs.
Browse files Browse the repository at this point in the history
  • Loading branch information
TannerRogalsky authored and dtolnay committed Jun 21, 2020
1 parent 8ff11dc commit d5e6436
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test_suite/tests/test_macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
}

0 comments on commit d5e6436

Please sign in to comment.