Skip to content

Commit 4189473

Browse files
committed
Fix missing const for inherent pointer replace methods
1 parent aae7e6c commit 4189473

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

core/src/ptr/mut_ptr.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1577,8 +1577,9 @@ impl<T: ?Sized> *mut T {
15771577
///
15781578
/// [`ptr::replace`]: crate::ptr::replace()
15791579
#[stable(feature = "pointer_methods", since = "1.26.0")]
1580+
#[rustc_const_stable(feature = "const_inherent_ptr_replace", since = "CURRENT_RUSTC_VERSION")]
15801581
#[inline(always)]
1581-
pub unsafe fn replace(self, src: T) -> T
1582+
pub const unsafe fn replace(self, src: T) -> T
15821583
where
15831584
T: Sized,
15841585
{

core/src/ptr/non_null.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1169,7 +1169,8 @@ impl<T: ?Sized> NonNull<T> {
11691169
/// [`ptr::replace`]: crate::ptr::replace()
11701170
#[inline(always)]
11711171
#[stable(feature = "non_null_convenience", since = "1.80.0")]
1172-
pub unsafe fn replace(self, src: T) -> T
1172+
#[rustc_const_stable(feature = "const_inherent_ptr_replace", since = "CURRENT_RUSTC_VERSION")]
1173+
pub const unsafe fn replace(self, src: T) -> T
11731174
where
11741175
T: Sized,
11751176
{

0 commit comments

Comments
 (0)