Skip to content

Commit

Permalink
Revert #85176 addition of clone_from for ManuallyDrop
Browse files Browse the repository at this point in the history
Forwarding `clone_from` to the inner value changes the observable
behavior, as previously the inner value would *not* be dropped by the
default implementation.
  • Loading branch information
petertodd committed May 27, 2021
1 parent ea78d1e commit 5b2076f
Showing 1 changed file with 1 addition and 14 deletions.
15 changes: 1 addition & 14 deletions library/core/src/mem/manually_drop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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)
}
}

0 comments on commit 5b2076f

Please sign in to comment.