Rollup merge of #86755 - ojeda:shrink, r=Mark-Simulacrum

alloc: `RawVec<T, A>::shrink` can be in `no_global_oom_handling`.

Found in https://github.com/Rust-for-Linux/linux/pull/402.

Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
This commit is contained in:
Yuki Okushi 2021-07-01 05:21:03 +09:00 committed by GitHub
commit 9e007e71ff
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -463,7 +463,6 @@ impl<T, A: Allocator> RawVec<T, A> {
Ok(()) Ok(())
} }
#[cfg(not(no_global_oom_handling))]
fn shrink(&mut self, amount: usize) -> Result<(), TryReserveError> { fn shrink(&mut self, amount: usize) -> Result<(), TryReserveError> {
assert!(amount <= self.capacity(), "Tried to shrink to a larger capacity"); assert!(amount <= self.capacity(), "Tried to shrink to a larger capacity");