From 5b2076ff01c75d4b7e09dac5b5630ecb16d66255 Mon Sep 17 00:00:00 2001 From: Peter Todd Date: Thu, 27 May 2021 14:01:16 -0400 Subject: [PATCH] Revert #85176 addition of `clone_from` for `ManuallyDrop` Forwarding `clone_from` to the inner value changes the observable behavior, as previously the inner value would *not* be dropped by the default implementation. --- library/core/src/mem/manually_drop.rs | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/library/core/src/mem/manually_drop.rs b/library/core/src/mem/manually_drop.rs index 5b99f6954e6..d86939454be 100644 --- a/library/core/src/mem/manually_drop.rs +++ b/library/core/src/mem/manually_drop.rs @@ -44,7 +44,7 @@ use crate::ptr; /// [`MaybeUninit`]: crate::mem::MaybeUninit #[stable(feature = "manually_drop", since = "1.20.0")] #[lang = "manually_drop"] -#[derive(Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +#[derive(Copy, Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] #[repr(transparent)] pub struct ManuallyDrop { value: T, @@ -160,16 +160,3 @@ impl DerefMut for ManuallyDrop { &mut self.value } } - -#[stable(feature = "manually_drop", since = "1.20.0")] -impl Clone for ManuallyDrop { - #[inline] - fn clone(&self) -> ManuallyDrop { - ManuallyDrop { value: self.value.clone() } - } - - #[inline] - fn clone_from(&mut self, other: &Self) { - self.value.clone_from(&other.value) - } -}