File tree 2 files changed +6
-5
lines changed
2 files changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -44,12 +44,16 @@ where
44
44
F : ToTokens ,
45
45
{
46
46
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( ) ;
48
49
let mut fields = vec![ #(
49
50
_h5:: types:: CompoundField {
50
51
name: #names. to_owned( ) ,
51
52
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
+ } ,
53
57
index: 0 ,
54
58
}
55
59
) , * ] ;
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
-
4
1
#[ macro_use]
5
2
extern crate hdf5_derive;
6
3
You can’t perform that action at this time.
0 commit comments