From 5a466434abcf19107792937dbcc0b57a0b84c8ad Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Wed, 20 Nov 2019 11:39:05 -0800 Subject: [PATCH] Avoid mem::uninitialized in par_sort_unstable A couple temporary `[u8; 128]` arrays were uninitialized, and are now initialized to zeros. This has no measurable affect on the benchmarks for `par_sort_unstable`. --- src/slice/quicksort.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/slice/quicksort.rs b/src/slice/quicksort.rs index 4fd781316..5e0325785 100644 --- a/src/slice/quicksort.rs +++ b/src/slice/quicksort.rs @@ -256,14 +256,14 @@ where let mut block_l = BLOCK; let mut start_l = ptr::null_mut(); let mut end_l = ptr::null_mut(); - let mut offsets_l: [u8; BLOCK] = unsafe { mem::uninitialized() }; + let mut offsets_l = [0u8; BLOCK]; // The current block on the right side (from `r.offset(-block_r)` to `r`). let mut r = unsafe { l.add(v.len()) }; let mut block_r = BLOCK; let mut start_r = ptr::null_mut(); let mut end_r = ptr::null_mut(); - let mut offsets_r: [u8; BLOCK] = unsafe { mem::uninitialized() }; + let mut offsets_r = [0u8; BLOCK]; // Returns the number of elements between pointers `l` (inclusive) and `r` (exclusive). fn width(l: *mut T, r: *mut T) -> usize {