Skip to content

Commit 7e2cf8d

Browse files
committed
remove MaybeUninit::uninit_array
1 parent 8a1f803 commit 7e2cf8d

File tree

1 file changed

+0
-36
lines changed

1 file changed

+0
-36
lines changed

library/core/src/mem/maybe_uninit.rs

-36
Original file line numberDiff line numberDiff line change
@@ -312,42 +312,6 @@ impl<T> MaybeUninit<T> {
312312
MaybeUninit { uninit: () }
313313
}
314314

315-
/// Creates a new array of `MaybeUninit<T>` items, in an uninitialized state.
316-
///
317-
/// Note: in a future Rust version this method may become unnecessary
318-
/// when Rust allows
319-
/// [inline const expressions](https://github.com/rust-lang/rust/issues/76001).
320-
/// The example below could then use `let mut buf = [const { MaybeUninit::<u8>::uninit() }; 32];`.
321-
///
322-
/// # Examples
323-
///
324-
/// ```no_run
325-
/// #![feature(maybe_uninit_uninit_array, maybe_uninit_slice)]
326-
///
327-
/// use std::mem::MaybeUninit;
328-
///
329-
/// extern "C" {
330-
/// fn read_into_buffer(ptr: *mut u8, max_len: usize) -> usize;
331-
/// }
332-
///
333-
/// /// Returns a (possibly smaller) slice of data that was actually read
334-
/// fn read(buf: &mut [MaybeUninit<u8>]) -> &[u8] {
335-
/// unsafe {
336-
/// let len = read_into_buffer(buf.as_mut_ptr() as *mut u8, buf.len());
337-
/// MaybeUninit::slice_assume_init_ref(&buf[..len])
338-
/// }
339-
/// }
340-
///
341-
/// let mut buf: [MaybeUninit<u8>; 32] = MaybeUninit::uninit_array();
342-
/// let data = read(&mut buf);
343-
/// ```
344-
#[unstable(feature = "maybe_uninit_uninit_array", issue = "96097")]
345-
#[must_use]
346-
#[inline(always)]
347-
pub const fn uninit_array<const N: usize>() -> [Self; N] {
348-
[const { MaybeUninit::uninit() }; N]
349-
}
350-
351315
/// Creates a new `MaybeUninit<T>` in an uninitialized state, with the memory being
352316
/// filled with `0` bytes. It depends on `T` whether that already makes for
353317
/// proper initialization. For example, `MaybeUninit<usize>::zeroed()` is initialized,

0 commit comments

Comments
 (0)