X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Fliballoc%2Fvec.rs;h=2f56898f4e9b66e43823aa765140932a0e082028;hb=654c180d05fedc8a9a3c793cfc747ad542d3a4f2;hp=269eeed3ccf8608ec0c2f9acb3656efead38c143;hpb=e601e2ac48a217fafb5962a43680d60c574d35ef;p=rust.git diff --git a/src/liballoc/vec.rs b/src/liballoc/vec.rs index 269eeed3ccf..2f56898f4e9 100644 --- a/src/liballoc/vec.rs +++ b/src/liballoc/vec.rs @@ -1274,12 +1274,10 @@ unsafe fn append_elements(&mut self, other: *const [T]) { /// Creates a draining iterator that removes the specified range in the vector /// and yields the removed items. /// - /// The element range is removed even if the iterator is only partially - /// consumed or not consumed at all. - /// - /// Note: Be aware that if the iterator is leaked (eg: [`mem::forget`]), it - /// cancels this property so it is unspecified how many elements are removed - /// from the vector in this case. + /// 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 /// @@ -1298,8 +1296,6 @@ unsafe fn append_elements(&mut self, other: *const [T]) { /// v.drain(..); /// assert_eq!(v, &[]); /// ``` - /// - /// [`mem::forget`]: mem::forget #[stable(feature = "drain", since = "1.6.0")] pub fn drain(&mut self, range: R) -> Drain<'_, T> where