add Drop
This commit is contained in:
parent
98eca207b1
commit
628b2d05c9
|
|
@ -33,6 +33,13 @@ impl<'a, Trait: ?Sized + 'a> Dyn<'a, Trait> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<'a, Trait: ?Sized + 'a> Drop for Dyn<'a, Trait> {
|
||||||
|
fn drop(&mut self) {
|
||||||
|
// SAFETY: `self` is valid for writing, and won't be accessed later.
|
||||||
|
unsafe { Self::ptr(self as *mut Self).drop_in_place() };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl<'a, Trait: ?Sized + 'a> ops::Deref for Dyn<'a, Trait> {
|
impl<'a, Trait: ?Sized + 'a> ops::Deref for Dyn<'a, Trait> {
|
||||||
type Target = Trait;
|
type Target = Trait;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user