Skip to content

Commit e5389a4

Browse files
Rollup merge of #76527 - fusion-engineering-forks:cleanup-uninit, r=jonas-schievink
Remove internal and unstable MaybeUninit::UNINIT. Looks like it is no longer necessary, as `uninit_array()` can be used instead in the few cases where it was needed. (I wanted to just add `#[doc(hidden)]` to remove clutter from the documentation, but looks like it can just be removed entirely.)
2 parents 581524e + 4506d26 commit e5389a4

File tree

3 files changed

+4
-13
lines changed

3 files changed

+4
-13
lines changed

library/alloc/src/collections/btree/node.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ impl<K, V> LeafNode<K, V> {
7878
LeafNode {
7979
// As a general policy, we leave fields uninitialized if they can be, as this should
8080
// be both slightly faster and easier to track in Valgrind.
81-
keys: [MaybeUninit::UNINIT; CAPACITY],
82-
vals: [MaybeUninit::UNINIT; CAPACITY],
81+
keys: MaybeUninit::uninit_array(),
82+
vals: MaybeUninit::uninit_array(),
8383
parent: ptr::null(),
8484
parent_idx: MaybeUninit::uninit(),
8585
len: 0,
@@ -111,7 +111,7 @@ impl<K, V> InternalNode<K, V> {
111111
/// `len` of 0), there must be one initialized and valid edge. This function does not set up
112112
/// such an edge.
113113
unsafe fn new() -> Self {
114-
InternalNode { data: unsafe { LeafNode::new() }, edges: [MaybeUninit::UNINIT; 2 * B] }
114+
InternalNode { data: unsafe { LeafNode::new() }, edges: MaybeUninit::uninit_array() }
115115
}
116116
}
117117

library/alloc/src/lib.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@
100100
#![feature(fn_traits)]
101101
#![feature(fundamental)]
102102
#![feature(inplace_iteration)]
103-
#![feature(internal_uninit_const)]
104103
#![feature(lang_items)]
105104
#![feature(layout_for_ptr)]
106105
#![feature(libc)]
@@ -135,7 +134,7 @@
135134
#![feature(unsized_locals)]
136135
#![feature(allocator_internals)]
137136
#![feature(slice_partition_dedup)]
138-
#![feature(maybe_uninit_extra, maybe_uninit_slice)]
137+
#![feature(maybe_uninit_extra, maybe_uninit_slice, maybe_uninit_uninit_array)]
139138
#![feature(alloc_layout_extra)]
140139
#![feature(trusted_random_access)]
141140
#![feature(try_trait)]

library/core/src/mem/maybe_uninit.rs

-8
Original file line numberDiff line numberDiff line change
@@ -306,14 +306,6 @@ impl<T> MaybeUninit<T> {
306306
unsafe { MaybeUninit::<[MaybeUninit<T>; LEN]>::uninit().assume_init() }
307307
}
308308

309-
/// A promotable constant, equivalent to `uninit()`.
310-
#[unstable(
311-
feature = "internal_uninit_const",
312-
issue = "none",
313-
reason = "hack to work around promotability"
314-
)]
315-
pub const UNINIT: Self = Self::uninit();
316-
317309
/// Creates a new `MaybeUninit<T>` in an uninitialized state, with the memory being
318310
/// filled with `0` bytes. It depends on `T` whether that already makes for
319311
/// proper initialization. For example, `MaybeUninit<usize>::zeroed()` is initialized,

0 commit comments

Comments
 (0)