File tree Expand file tree Collapse file tree 1 file changed +44
-0
lines changed Expand file tree Collapse file tree 1 file changed +44
-0
lines changed Original file line number Diff line number Diff line change @@ -484,6 +484,50 @@ fn test_into_bytes_struct() {
484484 }
485485 } no_build
486486 }
487+
488+ test ! {
489+ IntoBytes {
490+ #[ repr( C ) ]
491+ struct Foo {
492+ a: u8 ,
493+ b: [ Trailing ] ,
494+ }
495+ } expands to {
496+ #[ allow( deprecated) ]
497+ #[ automatically_derived]
498+ unsafe impl :: zerocopy:: IntoBytes for Foo
499+ where
500+ u8 : :: zerocopy:: IntoBytes ,
501+ [ Trailing ] : :: zerocopy:: IntoBytes ,
502+ ( ) : :: zerocopy:: util:: macro_util:: PaddingFree <
503+ Self ,
504+ { :: zerocopy:: struct_has_padding!( Self , [ u8 , [ Trailing ] ] ) } ,
505+ >,
506+ {
507+ fn only_derive_is_allowed_to_implement_this_trait( ) { }
508+ }
509+ } no_build
510+ }
511+
512+ test ! {
513+ IntoBytes {
514+ #[ repr( C ) ]
515+ struct Foo <Trailing > {
516+ a: u8 ,
517+ b: [ Trailing ] ,
518+ }
519+ } expands to {
520+ #[ allow( deprecated) ]
521+ #[ automatically_derived]
522+ unsafe impl <Trailing > :: zerocopy:: IntoBytes for Foo <Trailing >
523+ where
524+ u8 : :: zerocopy:: IntoBytes + :: zerocopy:: Unaligned ,
525+ [ Trailing ] : :: zerocopy:: IntoBytes + :: zerocopy:: Unaligned ,
526+ {
527+ fn only_derive_is_allowed_to_implement_this_trait( ) { }
528+ }
529+ } no_build
530+ }
487531}
488532
489533#[ test]
You can’t perform that action at this time.
0 commit comments