]> git.lizzy.rs Git - rust.git/commitdiff
note that calling drop() explicitly is a compiler error
authorMatthew Piziak <matthew.piziak@gmail.com>
Tue, 16 Aug 2016 08:33:59 +0000 (04:33 -0400)
committerMatthew Piziak <matthew.piziak@gmail.com>
Thu, 18 Aug 2016 20:31:32 +0000 (16:31 -0400)
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

src/libcore/ops.rs

index 9347ac2a8c82f0eb40d953f9318c39018ee72fa7..daa5ebb61f96d1c6141073b49a49ea29fb73d998 100644 (file)
@@ -102,6 +102,13 @@ pub trait Drop {
     ///
     /// After this function is over, the memory of `self` will be deallocated.
     ///
+    /// This function cannot be called explicitly. This is compiler error
+    /// [0040]. However, the [`std::mem::drop`] function in the prelude can be
+    /// used to call the argument's `Drop` implementation.
+    ///
+    /// [0040]: https://doc.rust-lang.org/error-index.html#E0040
+    /// [`std::mem::drop`]: https://doc.rust-lang.org/std/mem/fn.drop.html
+    ///
     /// # Panics
     ///
     /// Given that a `panic!` will call `drop()` as it unwinds, any `panic!` in