Skip to content

Commit bb03ef1

Browse files
author
Jonathan Turner
authored
Rollup merge of rust-lang#35710 - matthew-piziak:explicit-drop, r=steveklabnik
note that calling drop() explicitly is a compiler error Part of rust-lang#29365
2 parents 39501e9 + a516dbb commit bb03ef1

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Diff for: src/libcore/ops.rs

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

0 commit comments

Comments
 (0)