File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,14 @@ use rustc::{declare_tool_lint, lint_array};
12
12
/// `Drop::drop`, and that function is by fiat not callable in user code.
13
13
/// So there is really no use case for using `Drop` in trait bounds.
14
14
///
15
+ /// The most likely use case of a drop bound is to distinguish between types
16
+ /// that have destructors and types that don't. Combined with specialization,
17
+ /// a naive coder would write an implementation that assumed a type could be
18
+ /// trivially dropped, then write a specialization for `T: Drop` that actually
19
+ /// calls the destructor. Except that doing so is not correct; String, for
20
+ /// example, doesn't actually implement Drop, but because String contains a
21
+ /// Vec, assuming it can be trivially dropped will leak memory.
22
+ ///
15
23
/// **Known problems:** None.
16
24
///
17
25
/// **Example:**
You can’t perform that action at this time.
0 commit comments