diff options
| author | Steve Klabnik <steve@steveklabnik.com> | 2016-01-04 12:19:48 -0500 |
|---|---|---|
| committer | Steve Klabnik <steve@steveklabnik.com> | 2016-01-04 12:19:48 -0500 |
| commit | 3385fba264fccba07545314880788281e91ca34c (patch) | |
| tree | e18cdeb18d222fa1a21081fcd8eea7b7c0d03f00 | |
| parent | 191ff2d8fd57a8238d85302a8f06e2bd11b2f6d2 (diff) | |
Explain drop a bit more
Fixes #30655
| -rw-r--r-- | src/libcore/ops.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/libcore/ops.rs b/src/libcore/ops.rs index edbe64db080..1dc7a9ef2dc 100644 --- a/src/libcore/ops.rs +++ b/src/libcore/ops.rs @@ -95,6 +95,16 @@ use fmt; #[stable(feature = "rust1", since = "1.0.0")] pub trait Drop { /// A method called when the value goes out of scope. + /// + /// When this method has been called, `self` has not yet been deallocated. + /// If it were, `self` would be a dangling reference. + /// + /// After this function is over, the memory of `self` will be deallocated. + /// + /// # Panics + /// + /// Given that a `panic!` will call `drop()` as it unwinds, any `panic!` in + /// a `drop()` implementation will likely abort. #[stable(feature = "rust1", since = "1.0.0")] fn drop(&mut self); } |
