File tree 3 files changed +5
-4
lines changed
3 files changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ workspace = ".."
15
15
[dependencies ]
16
16
lazy_static = " 1"
17
17
libc = " 0.2"
18
+ maybe-uninit = " 2.0.0"
18
19
19
20
[build-dependencies ]
20
21
pkg-config = " 0.3.8"
Original file line number Diff line number Diff line change 10
10
extern crate lazy_static;
11
11
12
12
extern crate libc;
13
+ extern crate maybe_uninit;
13
14
14
15
#[ macro_use]
15
16
mod link;
Original file line number Diff line number Diff line change @@ -55,12 +55,11 @@ macro_rules! x11_link {
55
55
unsafe {
56
56
let libdir = $crate:: link:: config:: libdir:: $pkg_name;
57
57
let lib = try!( $crate:: link:: DynamicLibrary :: open_multi( libdir, & [ $( $lib_name) ,* ] ) ) ;
58
- let mut this: :: std:: mem:: ManuallyDrop <$struct_name>
59
- = :: std:: mem:: uninitialized( ) ;
60
- let this_ptr = & mut this as * mut _ as * mut $struct_name;
58
+ let mut this = :: maybe_uninit:: MaybeUninit :: <$struct_name>:: uninit( ) ;
59
+ let this_ptr = this. as_mut_ptr( ) ;
61
60
:: std:: ptr:: write( & mut ( * this_ptr) . lib, lib) ;
62
61
try!( Self :: init( this_ptr) ) ;
63
- Ok ( :: std :: mem :: ManuallyDrop :: into_inner ( this) )
62
+ Ok ( this. assume_init ( ) )
64
63
}
65
64
}
66
65
}
You can’t perform that action at this time.
0 commit comments