make NonNull::drop_in_place call drop_glue directly

This commit is contained in:
Waffle Lapkin
2026-04-08 14:59:29 +02:00
parent 278517f345
commit 94e4ddf127
2 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -822,7 +822,7 @@
/// Helper function for `drop_in_place`. The compiler replaces this by the actual drop glue.
#[lang = "drop_glue"]
const unsafe fn drop_glue<T: PointeeSized>(_: &mut T)
pub(crate) const unsafe fn drop_glue<T: PointeeSized>(_: &mut T)
where
T: [const] Destruct,
{
+2 -2
View File
@@ -1116,12 +1116,12 @@ pub unsafe fn read_volatile(self) -> T
#[inline(always)]
#[stable(feature = "non_null_convenience", since = "1.80.0")]
#[rustc_const_unstable(feature = "const_drop_in_place", issue = "109342")]
pub const unsafe fn drop_in_place(self)
pub const unsafe fn drop_in_place(mut self)
where
T: [const] Destruct,
{
// SAFETY: the caller must uphold the safety contract for `drop_in_place`.
unsafe { ptr::drop_in_place(self.as_ptr()) }
unsafe { ptr::drop_glue(self.as_mut()) }
}
/// Overwrites a memory location with the given value without reading or