tweak crate::MaybeUninit::unitialized

to not cause UB when unoptimized

appears to fix japaric/cortex-m-rtfm#182
This commit is contained in:
Jorge Aparicio 2019-05-02 12:28:17 +02:00
parent aab766f764
commit 6281cd359c

View File

@ -26,7 +26,9 @@ pub mod mem {
#[cfg(not(feature = "const-fn"))]
pub unsafe fn uninitialized() -> Self {
mem::uninitialized()
MaybeUninit {
value: ManuallyDrop::new(mem::uninitialized()),
}
}
/// Get a reference to the contained value.