@@ -426,7 +426,6 @@ impl<T> MaybeUninit<T> {
426
426
/// Correct usage of this method:
427
427
///
428
428
/// ```rust
429
- /// #![feature(maybe_uninit_extra)]
430
429
/// use std::mem::MaybeUninit;
431
430
///
432
431
/// let mut x = MaybeUninit::<Vec<u8>>::uninit();
@@ -445,7 +444,6 @@ impl<T> MaybeUninit<T> {
445
444
/// This usage of the method causes a leak:
446
445
///
447
446
/// ```rust
448
- /// #![feature(maybe_uninit_extra)]
449
447
/// use std::mem::MaybeUninit;
450
448
///
451
449
/// let mut x = MaybeUninit::<String>::uninit();
@@ -456,8 +454,8 @@ impl<T> MaybeUninit<T> {
456
454
/// // x is initialized now:
457
455
/// let s = unsafe { x.assume_init() };
458
456
/// ```
459
- #[ unstable ( feature = "maybe_uninit_extra " , issue = "63567 " ) ]
460
- #[ rustc_const_unstable( feature = "maybe_uninit_extra " , issue = "63567" ) ]
457
+ #[ stable ( feature = "maybe_uninit_write " , since = "1.55.0 " ) ]
458
+ #[ rustc_const_unstable( feature = "const_maybe_uninit_write " , issue = "63567" ) ]
461
459
#[ inline( always) ]
462
460
pub const fn write ( & mut self , val : T ) -> & mut T {
463
461
* self = MaybeUninit :: new ( val) ;
@@ -478,7 +476,7 @@ impl<T> MaybeUninit<T> {
478
476
/// use std::mem::MaybeUninit;
479
477
///
480
478
/// let mut x = MaybeUninit::<Vec<u32>>::uninit();
481
- /// unsafe { x.as_mut_ptr(). write(vec![0, 1, 2]); }
479
+ /// x. write(vec![0, 1, 2]);
482
480
/// // Create a reference into the `MaybeUninit<T>`. This is okay because we initialized it.
483
481
/// let x_vec = unsafe { &*x.as_ptr() };
484
482
/// assert_eq!(x_vec.len(), 3);
@@ -897,9 +895,9 @@ impl<T> MaybeUninit<T> {
897
895
/// use std::mem::MaybeUninit;
898
896
///
899
897
/// let mut array: [MaybeUninit<i32>; 3] = MaybeUninit::uninit_array();
900
- /// array[0] = MaybeUninit::new (0);
901
- /// array[1] = MaybeUninit::new (1);
902
- /// array[2] = MaybeUninit::new (2);
898
+ /// array[0].write (0);
899
+ /// array[1].write (1);
900
+ /// array[2].write (2);
903
901
///
904
902
/// // SAFETY: Now safe as we initialised all elements
905
903
/// let array = unsafe {
0 commit comments