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
This commit is contained in:
Matthias Krüger 2024-10-14 06:04:27 +02:00 committed by GitHub
commit cc5d86ac60
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 3 deletions

View File

@ -128,7 +128,6 @@
#![feature(const_ipv6)] #![feature(const_ipv6)]
#![feature(const_likely)] #![feature(const_likely)]
#![feature(const_make_ascii)] #![feature(const_make_ascii)]
#![feature(const_maybe_uninit_assume_init)]
#![feature(const_nonnull_new)] #![feature(const_nonnull_new)]
#![feature(const_num_midpoint)] #![feature(const_num_midpoint)]
#![feature(const_option_ext)] #![feature(const_option_ext)]

View File

@ -913,7 +913,11 @@ pub unsafe fn assume_init_drop(&mut self) {
/// }; /// };
/// ``` /// ```
#[stable(feature = "maybe_uninit_ref", since = "1.55.0")] #[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)] #[inline(always)]
pub const unsafe fn assume_init_mut(&mut self) -> &mut T { pub const unsafe fn assume_init_mut(&mut self) -> &mut T {
// SAFETY: the caller must guarantee that `self` is initialized. // SAFETY: the caller must guarantee that `self` is initialized.
@ -999,7 +1003,8 @@ pub unsafe fn assume_init_drop(&mut self) {
/// ///
/// [`assume_init_mut`]: MaybeUninit::assume_init_mut /// [`assume_init_mut`]: MaybeUninit::assume_init_mut
#[unstable(feature = "maybe_uninit_slice", issue = "63569")] #[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)] #[inline(always)]
pub const unsafe fn slice_assume_init_mut(slice: &mut [Self]) -> &mut [T] { 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 // SAFETY: similar to safety notes for `slice_get_ref`, but we have a