Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit b7c90c6

Browse files
workingjubileeRalfJung
andcommittedOct 5, 2024
library: Stabilize const MaybeUninit::assume_init_mut
Co-authored-by: Ralf Jung <post@ralfj.de>
1 parent 7d4319e commit b7c90c6

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed
 

‎core/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@
131131
#![feature(const_ipv6)]
132132
#![feature(const_likely)]
133133
#![feature(const_make_ascii)]
134-
#![feature(const_maybe_uninit_assume_init)]
135134
#![feature(const_nonnull_new)]
136135
#![feature(const_num_midpoint)]
137136
#![feature(const_option)]

‎core/src/mem/maybe_uninit.rs

+7-2
Original file line numberDiff line numberDiff line change
@@ -913,7 +913,11 @@ impl<T> MaybeUninit<T> {
913913
/// };
914914
/// ```
915915
#[stable(feature = "maybe_uninit_ref", since = "1.55.0")]
916-
#[rustc_const_unstable(feature = "const_maybe_uninit_assume_init", issue = "none")]
916+
#[cfg_attr(bootstrap, rustc_allow_const_fn_unstable(const_mut_refs))]
917+
#[rustc_const_stable(
918+
feature = "const_maybe_uninit_assume_init",
919+
since = "CURRENT_RUSTC_VERSION"
920+
)]
917921
#[inline(always)]
918922
pub const unsafe fn assume_init_mut(&mut self) -> &mut T {
919923
// SAFETY: the caller must guarantee that `self` is initialized.
@@ -999,7 +1003,8 @@ impl<T> MaybeUninit<T> {
9991003
///
10001004
/// [`assume_init_mut`]: MaybeUninit::assume_init_mut
10011005
#[unstable(feature = "maybe_uninit_slice", issue = "63569")]
1002-
#[rustc_const_unstable(feature = "const_maybe_uninit_assume_init", issue = "none")]
1006+
#[cfg_attr(bootstrap, rustc_allow_const_fn_unstable(const_mut_refs))]
1007+
#[rustc_const_unstable(feature = "maybe_uninit_slice", issue = "63569")]
10031008
#[inline(always)]
10041009
pub const unsafe fn slice_assume_init_mut(slice: &mut [Self]) -> &mut [T] {
10051010
// SAFETY: similar to safety notes for `slice_get_ref`, but we have a

0 commit comments

Comments
 (0)
Please sign in to comment.