From c12546bbad78f1cd4b5f05a37b9f479084422028 Mon Sep 17 00:00:00 2001 From: ultrabear Date: Wed, 18 Sep 2024 20:08:52 -0700 Subject: [PATCH 1/3] stabilize `const_maybe_uninit_as_mut_ptr` --- core/src/mem/maybe_uninit.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/mem/maybe_uninit.rs b/core/src/mem/maybe_uninit.rs index 0154caa7c24dd..d274445f5e4a7 100644 --- a/core/src/mem/maybe_uninit.rs +++ b/core/src/mem/maybe_uninit.rs @@ -393,7 +393,6 @@ impl MaybeUninit { // These are OK to allow since we do not leak &mut to user-visible API #[rustc_allow_const_fn_unstable(const_mut_refs)] #[rustc_allow_const_fn_unstable(const_ptr_write)] - #[rustc_allow_const_fn_unstable(const_maybe_uninit_as_mut_ptr)] #[rustc_const_stable(feature = "const_maybe_uninit_zeroed", since = "1.75.0")] pub const fn zeroed() -> MaybeUninit { let mut u = MaybeUninit::::uninit(); @@ -570,7 +569,8 @@ impl MaybeUninit { /// (Notice that the rules around references to uninitialized data are not finalized yet, but /// until they are, it is advisable to avoid them.) #[stable(feature = "maybe_uninit", since = "1.36.0")] - #[rustc_const_unstable(feature = "const_maybe_uninit_as_mut_ptr", issue = "75251")] + #[rustc_const_stable(feature = "const_maybe_uninit_as_mut_ptr", since = "CURRENT_RUSTC_VERSION")] + #[cfg_attr(bootstrap, rustc_allow_const_fn_unstable(const_mut_refs))] #[inline(always)] pub const fn as_mut_ptr(&mut self) -> *mut T { // `MaybeUninit` and `ManuallyDrop` are both `repr(transparent)` so we can cast the pointer. From 9510c7695c8e993108cadec4fa58c903aa7dd054 Mon Sep 17 00:00:00 2001 From: ultrabear Date: Wed, 18 Sep 2024 20:18:05 -0700 Subject: [PATCH 2/3] remove feature attributes as const_maybe_uninit_as_mut_ptr is stabilized --- alloc/src/lib.rs | 1 - core/src/lib.rs | 1 - core/tests/lib.rs | 1 - 3 files changed, 3 deletions(-) diff --git a/alloc/src/lib.rs b/alloc/src/lib.rs index f98c0cca1db47..f0597f295b3f0 100644 --- a/alloc/src/lib.rs +++ b/alloc/src/lib.rs @@ -110,7 +110,6 @@ #![feature(const_cow_is_borrowed)] #![feature(const_eval_select)] #![feature(const_heap)] -#![feature(const_maybe_uninit_as_mut_ptr)] #![feature(const_maybe_uninit_write)] #![feature(const_option)] #![feature(const_pin)] diff --git a/core/src/lib.rs b/core/src/lib.rs index 348ccebea3b84..e5a3d165a4351 100644 --- a/core/src/lib.rs +++ b/core/src/lib.rs @@ -131,7 +131,6 @@ #![feature(const_ipv4)] #![feature(const_ipv6)] #![feature(const_likely)] -#![feature(const_maybe_uninit_as_mut_ptr)] #![feature(const_maybe_uninit_assume_init)] #![feature(const_nonnull_new)] #![feature(const_num_midpoint)] diff --git a/core/tests/lib.rs b/core/tests/lib.rs index a0d6efc174392..5315ac856f692 100644 --- a/core/tests/lib.rs +++ b/core/tests/lib.rs @@ -26,7 +26,6 @@ #![feature(const_ipv4)] #![feature(const_ipv6)] #![feature(const_likely)] -#![feature(const_maybe_uninit_as_mut_ptr)] #![feature(const_nonnull_new)] #![feature(const_option)] #![feature(const_option_ext)] From ccb31b838d9314972668cf1a85b88d941cf8eaef Mon Sep 17 00:00:00 2001 From: ultrabear Date: Wed, 18 Sep 2024 20:49:53 -0700 Subject: [PATCH 3/3] run `x.py fmt` --- core/src/mem/maybe_uninit.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/src/mem/maybe_uninit.rs b/core/src/mem/maybe_uninit.rs index d274445f5e4a7..c67796ad3db83 100644 --- a/core/src/mem/maybe_uninit.rs +++ b/core/src/mem/maybe_uninit.rs @@ -569,7 +569,10 @@ impl MaybeUninit { /// (Notice that the rules around references to uninitialized data are not finalized yet, but /// until they are, it is advisable to avoid them.) #[stable(feature = "maybe_uninit", since = "1.36.0")] - #[rustc_const_stable(feature = "const_maybe_uninit_as_mut_ptr", since = "CURRENT_RUSTC_VERSION")] + #[rustc_const_stable( + feature = "const_maybe_uninit_as_mut_ptr", + since = "CURRENT_RUSTC_VERSION" + )] #[cfg_attr(bootstrap, rustc_allow_const_fn_unstable(const_mut_refs))] #[inline(always)] pub const fn as_mut_ptr(&mut self) -> *mut T {