Skip to content

Commit d7927ff

Browse files
committed
Add description of how values are dropped to Drop trait.
1 parent ca909c8 commit d7927ff

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/libcore/ops.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,13 @@ use marker::Unsize;
153153
/// The `Drop` trait is used to run some code when a value goes out of scope.
154154
/// This is sometimes called a 'destructor'.
155155
///
156-
///
156+
/// When a value goes out of scope, if it implements this trait, it will have
157+
/// its `drop` method called. Then any fields the value contains will also
158+
/// be dropped recursively.
159+
///
160+
/// Because of the recursive dropping, even for types that do not implement
161+
/// this trait, you do not need to implement this trait unless your type
162+
/// needs its own destructor logic.
157163
///
158164
/// # Examples
159165
///

0 commit comments

Comments
 (0)