This commit is contained in:
Justus K 2020-12-13 15:18:38 +01:00
parent d75618e7a2
commit 09d528ec15
No known key found for this signature in database
GPG key ID: 8C62FE98A62FC462

View file

@ -2796,7 +2796,7 @@ impl<T> From<Vec<T>> for VecDeque<T> {
// or doesn't have at least one free space.
// We check if `T` is a ZST in the first condition,
// because `usize::MAX` (the capacity returned by `capacity()` for ZST)
// is not a power of zero and thus it'll always try
// is not a power of two and thus it'll always try
// to reserve more memory which will panic for ZST (rust-lang/rust#78532)
if (!buf.capacity().is_power_of_two() && mem::size_of::<T>() != 0)
|| (buf.capacity() < (MINIMUM_CAPACITY + 1))