Skip to content

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

Move `wasmtime_environ::collections::Vec` to `wasmtime_core::alloc::Vec` (#12448)

Nick Fitzgeralde0ee455279d9
diff --git a/crates/core/src/alloc.rs b/crates/core/src/alloc.rs
index 1dd2c5f103..e5260512e1 100644
--- a/crates/core/src/alloc.rs
+++ b/crates/core/src/alloc.rs
@@ -3,9 +3,11 @@
mod arc;
mod boxed;
mod try_new;
+mod vec;
pub use boxed::{BoxedSliceFromIterError, new_boxed_slice_from_iter};
pub use try_new::{TryNew, try_new};
+pub use vec::Vec;
use crate::error::OutOfMemory;
use core::{alloc::Layout, ptr::NonNull};
diff --git a/crates/environ/src/collections/vec.rs b/crates/core/src/alloc/vec.rs
similarity index 98%
rename from crates/environ/src/collections/vec.rs
rename to crates/core/src/alloc/vec.rs
index 9d303af42c..232c3fe1f2 100644
--- a/crates/environ/src/collections/vec.rs
+++ b/crates/core/src/alloc/vec.rs
@@ -1,9 +1,9 @@
use crate::error::OutOfMemory;
-use alloc::vec::Vec as StdVec;
use core::{
fmt,
ops::{Deref, DerefMut, Index, IndexMut},
};
+use std_alloc::vec::Vec as StdVec;
/// Like `std::vec::Vec` but all methods that allocate force handling allocation
/// failure.
diff --git a/crates/environ/src/collections.rs b/crates/environ/src/collections.rs
index 952f09ad10..024c63a437 100644
--- a/crates/environ/src/collections.rs
+++ b/crates/environ/src/collections.rs
@@ -2,9 +2,7 @@
mod entity_set;
mod primary_map;
-mod vec;
pub use entity_set::EntitySet;
pub use primary_map::PrimaryMap;
-pub use vec::Vec;
-pub use wasmtime_core::alloc::{TryNew, try_new};
+pub use wasmtime_core::alloc::{TryNew, Vec, try_new};