From d7927ffb8f55e8a292c5d933325660141f0aab4e Mon Sep 17 00:00:00 2001 From: Havvy Date: Mon, 22 May 2017 15:59:00 -0700 Subject: [PATCH] Add description of how values are dropped to Drop trait. --- src/libcore/ops.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/libcore/ops.rs b/src/libcore/ops.rs index a2cdd646bd43..f2385cfcd787 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 ///