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: <#63567>
  • Loading branch information
tgross35 committed Oct 18, 2024
1 parent 1350eea commit 7808838
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
1 change: 0 additions & 1 deletion library/alloc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@
#![feature(const_box)]
#![feature(const_eval_select)]
#![feature(const_heap)]
#![feature(const_maybe_uninit_write)]
#![feature(const_size_of_val)]
#![feature(const_vec_string_slice)]
#![feature(core_intrinsics)]
Expand Down
4 changes: 2 additions & 2 deletions library/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 7808838

Please sign in to comment.