Skip to content

Commit

Permalink
Stabilize const_maybe_uninit_write
Browse files Browse the repository at this point in the history
Mark the following API const stable:

    impl<T> MaybeUninit<T> {
        pub const fn write(&mut self, val: T) -> &mut T;
    }

This depends on `const_mut_refs` and `const_maybe_uninit_assume_init`,
both of which have recently been stabilized.

Tracking issue: <rust-lang#63567>
  • Loading branch information
tgross35 authored and gitbot committed Mar 6, 2025
1 parent d0587b7 commit 025b71a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions core/src/mem/maybe_uninit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -485,9 +485,9 @@ impl<T> MaybeUninit<T> {
/// }
/// }
/// ```
#[stable(feature = "maybe_uninit_write", since = "1.55.0")]
#[rustc_const_unstable(feature = "const_maybe_uninit_write", issue = "63567")]
#[inline(always)]
#[stable(feature = "maybe_uninit_write", since = "1.55.0")]
#[rustc_const_stable(feature = "const_maybe_uninit_write", since = "CURRENT_RUSTC_VERSION")]
pub const fn write(&mut self, val: T) -> &mut T {
*self = MaybeUninit::new(val);
// SAFETY: We just initialized this value.
Expand Down

0 comments on commit 025b71a

Please sign in to comment.