Skip to content

Commit a516dbb

Browse files
note that calling drop() explicitly is a compiler error
Part of #29365 explain that std::mem::drop in prelude will invoke Drop change "prelude" -> "the prelude"; change links to reference-style move link references to links' section
1 parent f65d96f commit a516dbb

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/libcore/ops.rs

+7
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,13 @@ pub trait Drop {
102102
///
103103
/// After this function is over, the memory of `self` will be deallocated.
104104
///
105+
/// This function cannot be called explicitly. This is compiler error
106+
/// [0040]. However, the [`std::mem::drop`] function in the prelude can be
107+
/// used to call the argument's `Drop` implementation.
108+
///
109+
/// [0040]: https://doc.rust-lang.org/error-index.html#E0040
110+
/// [`std::mem::drop`]: https://doc.rust-lang.org/std/mem/fn.drop.html
111+
///
105112
/// # Panics
106113
///
107114
/// Given that a `panic!` will call `drop()` as it unwinds, any `panic!` in

0 commit comments

Comments
 (0)