Fix assertion in `shrink` to use `capacity()` instead

This commit is contained in:
Tim Diekmann 2020-03-25 18:41:25 +01:00
parent 42a8547038
commit ba26a9e957
1 changed files with 1 additions and 1 deletions

View File

@ -548,7 +548,7 @@ impl<T, A: AllocRef> RawVec<T, A> {
amount: usize,
placement: ReallocPlacement,
) -> Result<(), TryReserveError> {
assert!(amount <= self.cap, "Tried to shrink to a larger capacity");
assert!(amount <= self.capacity(), "Tried to shrink to a larger capacity");
let mut memory = if let Some(mem) = self.current_memory() { mem } else { return Ok(()) };
let new_size = amount * mem::size_of::<T>();