mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-16 21:15:18 +03:00
make NonNull::drop_in_place call drop_glue directly
This commit is contained in:
@@ -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,
|
||||
{
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user