]> git.lizzy.rs Git - rust.git/commitdiff
Add description of how values are dropped to Drop trait.
authorHavvy <ryan.havvy@gmail.com>
Mon, 22 May 2017 22:59:00 +0000 (15:59 -0700)
committerHavvy <ryan.havvy@gmail.com>
Mon, 22 May 2017 22:59:00 +0000 (15:59 -0700)
src/libcore/ops.rs

index a2cdd646bd43a036b973357e071b7da07589079f..f2385cfcd787b80fdc597f252ef8b1f1ea5b7182 100644 (file)
 /// 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
 ///