// except according to those terms.
use cmp;
-use mem;
+use mem::{self, MaybeUninit};
use ptr;
/// Rotation is much faster if it has access to a little bit of memory. This
}
impl<T> RawArray<T> {
- fn new() -> Self {
- unsafe { mem::uninitialized() }
- }
- fn ptr(&self) -> *mut T {
- unsafe { &self.typed as *const T as *mut T }
- }
fn cap() -> usize {
if mem::size_of::<T>() == 0 {
usize::max_value()
}
}
- let rawarray = RawArray::new();
- let buf = rawarray.ptr();
+ let mut rawarray = MaybeUninit::<RawArray<T>>::uninitialized();
+ let buf = &mut (*rawarray.as_mut_ptr()).typed as *mut [T; 2] as *mut T;
let dim = mid.sub(left).add(right);
if left <= right {