Fix missing const for inherent pointer replace methods

This commit is contained in:
Sky 2025-02-11 11:49:14 -05:00
parent 8c61cd4df8
commit 7bca1f2675
No known key found for this signature in database
GPG key ID: 2755A6B7099BC040
2 changed files with 4 additions and 2 deletions

View file

@ -1577,8 +1577,9 @@ impl<T: ?Sized> *mut T {
///
/// [`ptr::replace`]: crate::ptr::replace()
#[stable(feature = "pointer_methods", since = "1.26.0")]
#[rustc_const_stable(feature = "const_inherent_ptr_replace", since = "CURRENT_RUSTC_VERSION")]
#[inline(always)]
pub unsafe fn replace(self, src: T) -> T
pub const unsafe fn replace(self, src: T) -> T
where
T: Sized,
{

View file

@ -1169,7 +1169,8 @@ impl<T: ?Sized> NonNull<T> {
/// [`ptr::replace`]: crate::ptr::replace()
#[inline(always)]
#[stable(feature = "non_null_convenience", since = "1.80.0")]
pub unsafe fn replace(self, src: T) -> T
#[rustc_const_stable(feature = "const_inherent_ptr_replace", since = "CURRENT_RUSTC_VERSION")]
pub const unsafe fn replace(self, src: T) -> T
where
T: Sized,
{