Implement Drop for Box

This commit is contained in:
Vadim Petrochenkov
2017-01-21 22:44:44 +03:00
parent ffba0cea62
commit 4a4f8ff0a3
8 changed files with 18 additions and 33 deletions

View File

@@ -293,6 +293,14 @@ impl<T: ?Sized> Box<T> {
}
}
#[cfg(not(stage0))]
#[stable(feature = "rust1", since = "1.0.0")]
unsafe impl<#[may_dangle] T: ?Sized> Drop for Box<T> {
fn drop(&mut self) {
// FIXME: Do nothing, drop is currently performed by compiler.
}
}
#[stable(feature = "rust1", since = "1.0.0")]
impl<T: Default> Default for Box<T> {
/// Creates a `Box<T>`, with the `Default` value for T.