Skip to content

A lightweight WebAssembly runtime that is fast, secure, and standards-compliant

Implement `pop` for our OOM-handling `Vec` (#12471)

Nick Fitzgerald9cc85ab93355
diff --git a/crates/core/src/alloc/vec.rs b/crates/core/src/alloc/vec.rs
index 82bdc8af69..7bd09ede7a 100644
--- a/crates/core/src/alloc/vec.rs
+++ b/crates/core/src/alloc/vec.rs
@@ -83,6 +83,11 @@ impl<T> Vec<T> {
Ok(())
}
+ /// Same as [`std::vec::Vec::pop`].
+ pub fn pop(&mut self) -> Option<T> {
+ self.inner.pop()
+ }
+
/// Same as [`std::vec::Vec::into_raw_parts`].
pub fn into_raw_parts(mut self) -> (*mut T, usize, usize) {
// NB: Can't use `Vec::into_raw_parts` until our MSRV is >= 1.93.