diff --git a/library/alloc/src/vec.rs b/library/alloc/src/vec.rs index 202e3a836384d..0916ea37d073e 100644 --- a/library/alloc/src/vec.rs +++ b/library/alloc/src/vec.rs @@ -716,7 +716,7 @@ impl Vec { /// assert_eq!(vec, [1, 2]); /// ``` /// - /// No truncation occurs when `len` is greater than the vector's current + /// No truncation occurs when `len` is greater than or equal to the vector's current /// length: /// /// ``` @@ -746,7 +746,7 @@ impl Vec { // such that no value will be dropped twice in case `drop_in_place` // were to panic once (if it panics twice, the program aborts). unsafe { - if len > self.len { + if len >= self.len { return; } let remaining_len = self.len - len;