/// Temporary fork of some stuff in `core` that's doesn't have a `const fn` API pub mod mem { pub use core::mem::{replace, zeroed}; use core::ops::{Deref, DerefMut}; #[allow(unions_with_drop_fields)] pub union ManuallyDrop { value: T, } impl ManuallyDrop { #[inline] pub const fn new(value: T) -> ManuallyDrop { ManuallyDrop { value: value } } } impl Deref for ManuallyDrop { type Target = T; #[inline] fn deref(&self) -> &Self::Target { unsafe { &self.value } } } impl DerefMut for ManuallyDrop { #[inline] fn deref_mut(&mut self) -> &mut Self::Target { unsafe { &mut self.value } } } pub const unsafe fn uninitialized() -> T { #[allow(unions_with_drop_fields)] union U { none: (), some: T, } U { none: () }.some } }