Skip to content

Commit f47c280

Browse files
authored
Merge pull request #101 from ishitatsuyuki/sigill-fix
Fix SIGILL on nightly rustc (+ Introduces fallback crate as an interim workaround for backward compatibility)
2 parents 7fe4545 + e9cc5bb commit f47c280

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

x11-dl/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ workspace = ".."
1515
[dependencies]
1616
lazy_static = "1"
1717
libc = "0.2"
18+
maybe-uninit = "2.0.0"
1819

1920
[build-dependencies]
2021
pkg-config = "0.3.8"

x11-dl/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
extern crate lazy_static;
1111

1212
extern crate libc;
13+
extern crate maybe_uninit;
1314

1415
#[macro_use]
1516
mod link;

x11-dl/src/link.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,11 @@ macro_rules! x11_link {
5555
unsafe {
5656
let libdir = $crate::link::config::libdir::$pkg_name;
5757
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();
6160
::std::ptr::write(&mut (*this_ptr).lib, lib);
6261
try!(Self::init(this_ptr));
63-
Ok(::std::mem::ManuallyDrop::into_inner(this))
62+
Ok(this.assume_init())
6463
}
6564
}
6665
}

0 commit comments

Comments
 (0)