From 6828a1edc63819120c7d11544f149cdd839ef915 Mon Sep 17 00:00:00 2001 From: ltdk Date: Fri, 4 Oct 2024 13:03:43 -0400 Subject: [PATCH] Stabilize UnsafeCell::from_mut --- library/core/src/cell.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/library/core/src/cell.rs b/library/core/src/cell.rs index de212581e82..26be316a7b9 100644 --- a/library/core/src/cell.rs +++ b/library/core/src/cell.rs @@ -2115,7 +2115,6 @@ impl UnsafeCell { /// # Examples /// /// ``` - /// # #![feature(unsafe_cell_from_mut)] /// use std::cell::UnsafeCell; /// /// let mut val = 42; @@ -2125,7 +2124,9 @@ impl UnsafeCell { /// assert_eq!(*uc.get_mut(), 41); /// ``` #[inline(always)] - #[unstable(feature = "unsafe_cell_from_mut", issue = "111645")] + #[stable(feature = "unsafe_cell_from_mut", since = "CURRENT_RUSTC_VERSION")] + #[rustc_const_stable(feature = "unsafe_cell_from_mut", since = "CURRENT_RUSTC_VERSION")] + #[cfg_attr(bootstrap, rustc_allow_const_fn_unstable(const_mut_refs))] pub const fn from_mut(value: &mut T) -> &mut UnsafeCell { // SAFETY: `UnsafeCell` has the same memory layout as `T` due to #[repr(transparent)]. unsafe { &mut *(value as *mut T as *mut UnsafeCell) }