about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-10-14 06:04:27 +0200
committerGitHub <noreply@github.com>2024-10-14 06:04:27 +0200
commitcc5d86ac605e48192ccc6df67fbd4257df671b6a (patch)
tree95e2747650314c9842090cc313866632dbebaf75
parente01eae72daff6e7931d4aa05250480e404f15efc (diff)
parent0b00a54976cfa70b47dbb897db6066cb9557813c (diff)
downloadrust-cc5d86ac605e48192ccc6df67fbd4257df671b6a.tar.gz
rust-cc5d86ac605e48192ccc6df67fbd4257df671b6a.zip
Rollup merge of #131274 - workingjubilee:stabilize-the-one-that-got-away, r=scottmcm
library: Const-stabilize `MaybeUninit::assume_init_mut`

FCP completed in https://github.com/rust-lang/rust/issues/86722#issuecomment-2393954459

Also moves const-ness of an unstable fn under the `maybe_uninit_slice` gate, Cc https://github.com/rust-lang/rust/issues/63569
-rw-r--r--library/core/src/lib.rs1
-rw-r--r--library/core/src/mem/maybe_uninit.rs9
2 files changed, 7 insertions, 3 deletions
diff --git a/library/core/src/lib.rs b/library/core/src/lib.rs
index b21618e28a4..efdf95aa5ad 100644
--- a/library/core/src/lib.rs
+++ b/library/core/src/lib.rs
@@ -128,7 +128,6 @@
 #![feature(const_ipv6)]
 #![feature(const_likely)]
 #![feature(const_make_ascii)]
-#![feature(const_maybe_uninit_assume_init)]
 #![feature(const_nonnull_new)]
 #![feature(const_num_midpoint)]
 #![feature(const_option_ext)]
diff --git a/library/core/src/mem/maybe_uninit.rs b/library/core/src/mem/maybe_uninit.rs
index c67796ad3db..f992785c43b 100644
--- a/library/core/src/mem/maybe_uninit.rs
+++ b/library/core/src/mem/maybe_uninit.rs
@@ -913,7 +913,11 @@ impl<T> MaybeUninit<T> {
     /// };
     /// ```
     #[stable(feature = "maybe_uninit_ref", since = "1.55.0")]
-    #[rustc_const_unstable(feature = "const_maybe_uninit_assume_init", issue = "none")]
+    #[cfg_attr(bootstrap, rustc_allow_const_fn_unstable(const_mut_refs))]
+    #[rustc_const_stable(
+        feature = "const_maybe_uninit_assume_init",
+        since = "CURRENT_RUSTC_VERSION"
+    )]
     #[inline(always)]
     pub const unsafe fn assume_init_mut(&mut self) -> &mut T {
         // SAFETY: the caller must guarantee that `self` is initialized.
@@ -999,7 +1003,8 @@ impl<T> MaybeUninit<T> {
     ///
     /// [`assume_init_mut`]: MaybeUninit::assume_init_mut
     #[unstable(feature = "maybe_uninit_slice", issue = "63569")]
-    #[rustc_const_unstable(feature = "const_maybe_uninit_assume_init", issue = "none")]
+    #[cfg_attr(bootstrap, rustc_allow_const_fn_unstable(const_mut_refs))]
+    #[rustc_const_unstable(feature = "maybe_uninit_slice", issue = "63569")]
     #[inline(always)]
     pub const unsafe fn slice_assume_init_mut(slice: &mut [Self]) -> &mut [T] {
         // SAFETY: similar to safety notes for `slice_get_ref`, but we have a