Skip to content

Commit ad261f6

Browse files
committed
avoid uninit_array! macro where it is not needed
1 parent e074db7 commit ad261f6

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

src/libcore/fmt/num.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ trait GenericRadix {
5151
// characters for a base 2 number.
5252
let zero = T::zero();
5353
let is_nonnegative = x >= zero;
54-
let mut buf = uninit_array![u8; 128];
54+
let mut buf = [MaybeUninit::<u8>::uninit(); 128];
5555
let mut curr = buf.len();
5656
let base = T::from_u8(Self::BASE);
5757
if is_nonnegative {
@@ -189,7 +189,7 @@ static DEC_DIGITS_LUT: &[u8; 200] =
189189
macro_rules! impl_Display {
190190
($($t:ident),* as $u:ident via $conv_fn:ident named $name:ident) => {
191191
fn $name(mut n: $u, is_nonnegative: bool, f: &mut fmt::Formatter<'_>) -> fmt::Result {
192-
let mut buf = uninit_array![u8; 39];
192+
let mut buf = [MaybeUninit::<u8>::uninit(); 39];
193193
let mut curr = buf.len() as isize;
194194
let buf_ptr = MaybeUninit::first_ptr_mut(&mut buf);
195195
let lut_ptr = DEC_DIGITS_LUT.as_ptr();

src/libcore/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@
7575
#![feature(const_fn)]
7676
#![feature(const_fn_union)]
7777
#![cfg_attr(not(bootstrap), feature(const_generics))]
78-
#![cfg_attr(not(bootstrap), feature(const_in_array_repeat_expressions))]
7978
#![feature(custom_inner_attributes)]
8079
#![feature(decl_macro)]
8180
#![feature(doc_cfg)]

src/libcore/slice/sort.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,14 +216,14 @@ fn partition_in_blocks<T, F>(v: &mut [T], pivot: &T, is_less: &mut F) -> usize
216216
let mut block_l = BLOCK;
217217
let mut start_l = ptr::null_mut();
218218
let mut end_l = ptr::null_mut();
219-
let mut offsets_l: [MaybeUninit<u8>; BLOCK] = uninit_array![u8; BLOCK];
219+
let mut offsets_l = [MaybeUninit::<u8>::uninit(); BLOCK];
220220

221221
// The current block on the right side (from `r.sub(block_r)` to `r`).
222222
let mut r = unsafe { l.add(v.len()) };
223223
let mut block_r = BLOCK;
224224
let mut start_r = ptr::null_mut();
225225
let mut end_r = ptr::null_mut();
226-
let mut offsets_r: [MaybeUninit<u8>; BLOCK] = uninit_array![u8; BLOCK];
226+
let mut offsets_r = [MaybeUninit::<u8>::uninit(); BLOCK];
227227

228228
// FIXME: When we get VLAs, try creating one array of length `min(v.len(), 2 * BLOCK)` rather
229229
// than two fixed-size arrays of length `BLOCK`. VLAs might be more cache-efficient.

0 commit comments

Comments
 (0)