Skip to content

Commit eee4067

Browse files
committed
rebase
2 parents ba52720 + 6d2dc28 commit eee4067

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

library/alloc/src/collections/vec_deque/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2087,7 +2087,7 @@ impl<T, A: Allocator> VecDeque<T, A> {
20872087
// buffer without it being full emerge
20882088
debug_assert!(self.is_full());
20892089
let old_cap = self.capacity();
2090-
self.buf.reserve_for_push(old_cap);
2090+
self.buf.reserve_for_push();
20912091
unsafe {
20922092
self.handle_capacity_increase(old_cap);
20932093
}

library/alloc/src/raw_vec.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -349,8 +349,8 @@ impl<T, A: Allocator> RawVec<T, A> {
349349
/// oft-instantiated `Vec::push()`, which does its own capacity check.
350350
#[cfg(not(no_global_oom_handling))]
351351
#[inline(never)]
352-
pub fn reserve_for_push(&mut self, len: usize) {
353-
if let Err(err) = self.grow_amortized(len, 1) {
352+
pub fn reserve_for_push(&mut self) {
353+
if let Err(err) = self.grow_amortized(self.cap.0, 1) {
354354
handle_error(err);
355355
}
356356
}

library/alloc/src/vec/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1547,7 +1547,7 @@ impl<T, A: Allocator> Vec<T, A> {
15471547

15481548
// space for the new element
15491549
if len == self.buf.capacity() {
1550-
self.reserve(1);
1550+
self.buf.reserve_for_push();
15511551
}
15521552

15531553
unsafe {
@@ -1967,7 +1967,7 @@ impl<T, A: Allocator> Vec<T, A> {
19671967
// This will panic or abort if we would allocate > isize::MAX bytes
19681968
// or if the length increment would overflow for zero-sized types.
19691969
if self.len == self.buf.capacity() {
1970-
self.buf.reserve_for_push(self.len);
1970+
self.buf.reserve_for_push();
19711971
}
19721972
unsafe {
19731973
let end = self.as_mut_ptr().add(self.len);

0 commit comments

Comments
 (0)