@@ -331,42 +331,6 @@ impl<T> MaybeUninit<T> {
331331 MaybeUninit { uninit : ( ) }
332332 }
333333
334- /// Creates a new array of `MaybeUninit<T>` items, in an uninitialized state.
335- ///
336- /// Note: in a future Rust version this method may become unnecessary
337- /// when Rust allows
338- /// [inline const expressions](https://github.com/rust-lang/rust/issues/76001).
339- /// The example below could then use `let mut buf = [const { MaybeUninit::<u8>::uninit() }; 32];`.
340- ///
341- /// # Examples
342- ///
343- /// ```no_run
344- /// #![feature(maybe_uninit_uninit_array, maybe_uninit_slice)]
345- ///
346- /// use std::mem::MaybeUninit;
347- ///
348- /// unsafe extern "C" {
349- /// fn read_into_buffer(ptr: *mut u8, max_len: usize) -> usize;
350- /// }
351- ///
352- /// /// Returns a (possibly smaller) slice of data that was actually read
353- /// fn read(buf: &mut [MaybeUninit<u8>]) -> &[u8] {
354- /// unsafe {
355- /// let len = read_into_buffer(buf.as_mut_ptr() as *mut u8, buf.len());
356- /// buf[..len].assume_init_ref()
357- /// }
358- /// }
359- ///
360- /// let mut buf: [MaybeUninit<u8>; 32] = MaybeUninit::uninit_array();
361- /// let data = read(&mut buf);
362- /// ```
363- #[ unstable( feature = "maybe_uninit_uninit_array" , issue = "96097" ) ]
364- #[ must_use]
365- #[ inline( always) ]
366- pub const fn uninit_array < const N : usize > ( ) -> [ Self ; N ] {
367- [ const { MaybeUninit :: uninit ( ) } ; N ]
368- }
369-
370334 /// Creates a new `MaybeUninit<T>` in an uninitialized state, with the memory being
371335 /// filled with `0` bytes. It depends on `T` whether that already makes for
372336 /// proper initialization. For example, `MaybeUninit<usize>::zeroed()` is initialized,
0 commit comments