Skip to content

Commit 4f06ced

Browse files
author
bcoopers
committed
If doubling the vector in reserve() brings you over usize::MAX,
try to get capacity for usize::MAX
1 parent 1caf260 commit 4f06ced

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/libcollections/vec.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ impl<T> Vec<T> {
309309

310310
let new_min_cap = self.len.checked_add(additional).expect(err_msg);
311311
match new_min_cap.checked_next_power_of_two() {
312-
None => self.grow_capacity(new_min_cap),
312+
None => self.grow_capacity(usize::MAX),
313313
Some(x) => self.grow_capacity(x),
314314
}
315315
}

0 commit comments

Comments
 (0)