diff options
| author | Peter Todd <pete@petertodd.org> | 2021-05-27 14:01:16 -0400 |
|---|---|---|
| committer | Peter Todd <pete@petertodd.org> | 2021-05-27 14:01:16 -0400 |
| commit | 5b2076ff01c75d4b7e09dac5b5630ecb16d66255 (patch) | |
| tree | de33e69cfe4c1a0eacf80ca0291d44b3b9e12a33 | |
| parent | ea78d1edf364dd3a4b5ff430f76e2bdd3a713a45 (diff) | |
| download | rust-5b2076ff01c75d4b7e09dac5b5630ecb16d66255.tar.gz rust-5b2076ff01c75d4b7e09dac5b5630ecb16d66255.zip | |
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.
| -rw-r--r-- | library/core/src/mem/manually_drop.rs | 15 |
1 files changed, 1 insertions, 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<T>`]: 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<T: ?Sized> { value: T, @@ -160,16 +160,3 @@ impl<T: ?Sized> DerefMut for ManuallyDrop<T> { &mut self.value } } - -#[stable(feature = "manually_drop", since = "1.20.0")] -impl<T: Clone> Clone for ManuallyDrop<T> { - #[inline] - fn clone(&self) -> ManuallyDrop<T> { - ManuallyDrop { value: self.value.clone() } - } - - #[inline] - fn clone_from(&mut self, other: &Self) { - self.value.clone_from(&other.value) - } -} |
