diff options
| author | Havvy <ryan.havvy@gmail.com> | 2017-05-22 15:59:00 -0700 |
|---|---|---|
| committer | Havvy <ryan.havvy@gmail.com> | 2017-05-22 15:59:00 -0700 |
| commit | d7927ffb8f55e8a292c5d933325660141f0aab4e (patch) | |
| tree | 9189ca17e8e82c7db5c91be15382cb5617e53687 /src | |
| parent | ca909c836fb509bcda5471cdeef0dd9ccd00c54d (diff) | |
| download | rust-d7927ffb8f55e8a292c5d933325660141f0aab4e.tar.gz rust-d7927ffb8f55e8a292c5d933325660141f0aab4e.zip | |
Add description of how values are dropped to Drop trait.
Diffstat (limited to 'src')
| -rw-r--r-- | src/libcore/ops.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/libcore/ops.rs b/src/libcore/ops.rs index a2cdd646bd4..f2385cfcd78 100644 --- a/src/libcore/ops.rs +++ b/src/libcore/ops.rs @@ -153,7 +153,13 @@ use marker::Unsize; /// The `Drop` trait is used to run some code when a value goes out of scope. /// This is sometimes called a 'destructor'. /// -/// +/// When a value goes out of scope, if it implements this trait, it will have +/// its `drop` method called. Then any fields the value contains will also +/// be dropped recursively. +/// +/// Because of the recursive dropping, even for types that do not implement +/// this trait, you do not need to implement this trait unless your type +/// needs its own destructor logic. /// /// # Examples /// |
