Skip to content

Commit 50afc52

Browse files
committedOct 4, 2024
Stabilize UnsafeCell::from_mut
1 parent 1bd16cd commit 50afc52

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed
 

‎core/src/cell.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -2115,7 +2115,6 @@ impl<T: ?Sized> UnsafeCell<T> {
21152115
/// # Examples
21162116
///
21172117
/// ```
2118-
/// # #![feature(unsafe_cell_from_mut)]
21192118
/// use std::cell::UnsafeCell;
21202119
///
21212120
/// let mut val = 42;
@@ -2125,7 +2124,9 @@ impl<T: ?Sized> UnsafeCell<T> {
21252124
/// assert_eq!(*uc.get_mut(), 41);
21262125
/// ```
21272126
#[inline(always)]
2128-
#[unstable(feature = "unsafe_cell_from_mut", issue = "111645")]
2127+
#[stable(feature = "unsafe_cell_from_mut", since = "CURRENT_RUSTC_VERSION")]
2128+
#[rustc_const_stable(feature = "unsafe_cell_from_mut", since = "CURRENT_RUSTC_VERSION")]
2129+
#[cfg_attr(bootstrap, rustc_allow_const_fn_unstable(const_mut_refs))]
21292130
pub const fn from_mut(value: &mut T) -> &mut UnsafeCell<T> {
21302131
// SAFETY: `UnsafeCell<T>` has the same memory layout as `T` due to #[repr(transparent)].
21312132
unsafe { &mut *(value as *mut T as *mut UnsafeCell<T>) }

0 commit comments

Comments
 (0)
Please sign in to comment.