diff --git a/test_suite/tests/test_macros.rs b/test_suite/tests/test_macros.rs index c0c807ec..bcd16b48 100644 --- a/test_suite/tests/test_macros.rs +++ b/test_suite/tests/test_macros.rs @@ -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, + } +}