about summary refs log tree commit diff
path: root/src/liballoc
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-07-25 03:38:30 +0000
committerbors <bors@rust-lang.org>2020-07-25 03:38:30 +0000
commit0e11fc8053d32c44e7152865852acc5c3c54efb3 (patch)
tree3bd49b88220455ed90a430f39a68bf14fc10cdf1 /src/liballoc
parentc4e173472beb073ce3759525a15ed429b032787a (diff)
parent654c180d05fedc8a9a3c793cfc747ad542d3a4f2 (diff)
downloadrust-0e11fc8053d32c44e7152865852acc5c3c54efb3.tar.gz
rust-0e11fc8053d32c44e7152865852acc5c3c54efb3.zip
Auto merge of #74652 - poliorcetics:clarify-vec-drain-doc, r=jyn514
Improve the documentation for Vec::drain

Fixes #73844.

@rusbot modify labels: A-collections, C-enhancement, T-doc, T-libs
Diffstat (limited to 'src/liballoc')
-rw-r--r--src/liballoc/vec.rs9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/liballoc/vec.rs b/src/liballoc/vec.rs
index 5db96a504a6..2f56898f4e9 100644
--- a/src/liballoc/vec.rs
+++ b/src/liballoc/vec.rs
@@ -1274,11 +1274,10 @@ impl<T> Vec<T> {
     /// Creates a draining iterator that removes the specified range in the vector
     /// and yields the removed items.
     ///
-    /// Note 1: The element range is removed even if the iterator is only
-    /// partially consumed or not consumed at all.
-    ///
-    /// Note 2: It is unspecified how many elements are removed from the vector
-    /// if the `Drain` value is leaked.
+    /// When the iterator **is** dropped, all elements in the range are removed
+    /// from the vector, even if the iterator was not fully consumed. If the
+    /// iterator **is not** dropped (with [`mem::forget`] for example), it is
+    /// unspecified how many elements are removed.
     ///
     /// # Panics
     ///