1717//! stable sorting implementation.
1818
1919use cmp;
20- use mem;
20+ use mem:: { self , MaybeUninit } ;
2121use ptr;
2222
2323/// When dropped, copies from `src` into `dest`.
@@ -226,14 +226,14 @@ fn partition_in_blocks<T, F>(v: &mut [T], pivot: &T, is_less: &mut F) -> usize
226226 let mut block_l = BLOCK ;
227227 let mut start_l = ptr:: null_mut ( ) ;
228228 let mut end_l = ptr:: null_mut ( ) ;
229- let mut offsets_l: [ u8 ; BLOCK ] = unsafe { mem :: uninitialized ( ) } ;
229+ let mut offsets_l = MaybeUninit :: < [ u8 ; BLOCK ] > :: uninitialized ( ) ;
230230
231231 // The current block on the right side (from `r.sub(block_r)` to `r`).
232232 let mut r = unsafe { l. add ( v. len ( ) ) } ;
233233 let mut block_r = BLOCK ;
234234 let mut start_r = ptr:: null_mut ( ) ;
235235 let mut end_r = ptr:: null_mut ( ) ;
236- let mut offsets_r: [ u8 ; BLOCK ] = unsafe { mem :: uninitialized ( ) } ;
236+ let mut offsets_r = MaybeUninit :: < [ u8 ; BLOCK ] > :: uninitialized ( ) ;
237237
238238 // FIXME: When we get VLAs, try creating one array of length `min(v.len(), 2 * BLOCK)` rather
239239 // than two fixed-size arrays of length `BLOCK`. VLAs might be more cache-efficient.
@@ -272,8 +272,8 @@ fn partition_in_blocks<T, F>(v: &mut [T], pivot: &T, is_less: &mut F) -> usize
272272
273273 if start_l == end_l {
274274 // Trace `block_l` elements from the left side.
275- start_l = offsets_l. as_mut_ptr ( ) ;
276- end_l = offsets_l. as_mut_ptr ( ) ;
275+ start_l = offsets_l. as_mut_ptr ( ) as * mut u8 ;
276+ end_l = offsets_l. as_mut_ptr ( ) as * mut u8 ;
277277 let mut elem = l;
278278
279279 for i in 0 ..block_l {
@@ -288,8 +288,8 @@ fn partition_in_blocks<T, F>(v: &mut [T], pivot: &T, is_less: &mut F) -> usize
288288
289289 if start_r == end_r {
290290 // Trace `block_r` elements from the right side.
291- start_r = offsets_r. as_mut_ptr ( ) ;
292- end_r = offsets_r. as_mut_ptr ( ) ;
291+ start_r = offsets_r. as_mut_ptr ( ) as * mut u8 ;
292+ end_r = offsets_r. as_mut_ptr ( ) as * mut u8 ;
293293 let mut elem = r;
294294
295295 for i in 0 ..block_r {
0 commit comments