We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b1277d0 commit 181d811Copy full SHA for 181d811
library/alloc/src/vec.rs
@@ -716,7 +716,7 @@ impl<T> Vec<T> {
716
/// assert_eq!(vec, [1, 2]);
717
/// ```
718
///
719
- /// 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
720
/// length:
721
722
@@ -746,7 +746,7 @@ impl<T> Vec<T> {
746
// such that no value will be dropped twice in case `drop_in_place`
747
// were to panic once (if it panics twice, the program aborts).
748
unsafe {
749
- if len > self.len {
+ if len >= self.len {
750
return;
751
}
752
let remaining_len = self.len - len;
0 commit comments