File tree Expand file tree Collapse file tree 2 files changed +6
-5
lines changed
Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -44,12 +44,16 @@ where
4444 F : ToTokens ,
4545{
4646 quote ! {
47- let origin: * const #ty #ty_generics = :: std:: ptr:: null( ) ;
47+ let origin = :: std:: mem:: MaybeUninit :: <#ty #ty_generics>:: uninit( ) ;
48+ let origin_ptr = origin. as_ptr( ) ;
4849 let mut fields = vec![ #(
4950 _h5:: types:: CompoundField {
5051 name: #names. to_owned( ) ,
5152 ty: <#types as _h5:: types:: H5Type >:: type_descriptor( ) ,
52- offset: unsafe { & ( ( * origin) . #fields) as * const _ as _ } ,
53+ offset: unsafe {
54+ :: std:: ptr:: addr_of!( ( * origin_ptr) . #fields) . cast:: <u8 >( )
55+ . offset_from( origin_ptr. cast( ) ) as usize
56+ } ,
5357 index: 0 ,
5458 }
5559 ) , * ] ;
Original file line number Diff line number Diff line change 1- // due to compiler wrongfully complaining re: Copy impl missing for packed struct
2- #![ allow( unaligned_references) ]
3-
41#[ macro_use]
52extern crate hdf5_derive;
63
You can’t perform that action at this time.
0 commit comments