diff --git a/crates/wasmtime/src/compile.rs b/crates/wasmtime/src/compile.rs index 6021c627fb7..41d7c01f8fd 100644 --- a/crates/wasmtime/src/compile.rs +++ b/crates/wasmtime/src/compile.rs @@ -22,12 +22,14 @@ //! functions. It is up to the caller to serialize the relevant parts of the //! `Artifacts` into the ELF file. +use crate::hash_map::HashMap; +use crate::hash_set::HashSet; use crate::prelude::*; use crate::Engine; use std::{ any::Any, borrow::Cow, - collections::{btree_map, BTreeMap, BTreeSet, HashMap, HashSet}, + collections::{btree_map, BTreeMap, BTreeSet}, mem, }; diff --git a/crates/wasmtime/src/config.rs b/crates/wasmtime/src/config.rs index ba36aee5378..84d7e7367bd 100644 --- a/crates/wasmtime/src/config.rs +++ b/crates/wasmtime/src/config.rs @@ -1,9 +1,10 @@ +use crate::hash_map::HashMap; +use crate::hash_set::HashSet; use crate::prelude::*; use alloc::sync::Arc; use bitflags::Flags; use core::fmt; use core::str::FromStr; -use hashbrown::{HashMap, HashSet}; use serde_derive::{Deserialize, Serialize}; #[cfg(any(feature = "cache", feature = "cranelift", feature = "winch"))] use std::path::Path; diff --git a/crates/wasmtime/src/lib.rs b/crates/wasmtime/src/lib.rs index 9a8139fb82f..104a4e08c0c 100644 --- a/crates/wasmtime/src/lib.rs +++ b/crates/wasmtime/src/lib.rs @@ -294,6 +294,8 @@ pub(crate) mod prelude { pub use wasmtime_environ::prelude::*; } +pub(crate) use hashbrown::{hash_map, hash_set}; + /// A helper macro to safely map `MaybeUninit` to `MaybeUninit` where `U` /// is a field projection within `T`. /// diff --git a/crates/wasmtime/src/runtime/component/linker.rs b/crates/wasmtime/src/runtime/component/linker.rs index 267ad8d4298..31a3d525488 100644 --- a/crates/wasmtime/src/runtime/component/linker.rs +++ b/crates/wasmtime/src/runtime/component/linker.rs @@ -5,13 +5,13 @@ use crate::component::types; use crate::component::{ Component, ComponentNamedList, Instance, InstancePre, Lift, Lower, ResourceType, Val, }; +use crate::hash_map::HashMap; use crate::prelude::*; use crate::{AsContextMut, Engine, Module, StoreContextMut}; use alloc::sync::Arc; use core::future::Future; use core::marker; use core::pin::Pin; -use hashbrown::hash_map::HashMap; use wasmtime_environ::component::{NameMap, NameMapIntern}; use wasmtime_environ::PrimaryMap; diff --git a/crates/wasmtime/src/runtime/component/resource_table.rs b/crates/wasmtime/src/runtime/component/resource_table.rs index 2314a970413..63ac62bf3ef 100644 --- a/crates/wasmtime/src/runtime/component/resource_table.rs +++ b/crates/wasmtime/src/runtime/component/resource_table.rs @@ -290,7 +290,7 @@ impl ResourceTable { #[cfg(feature = "std")] pub fn iter_entries<'a, T>( &'a mut self, - map: std::collections::HashMap, + map: crate::hash_map::HashMap, ) -> impl Iterator, T)> { map.into_iter().map(move |(k, v)| { let item = self diff --git a/crates/wasmtime/src/runtime/coredump.rs b/crates/wasmtime/src/runtime/coredump.rs index fe6fa4377e6..11b5c0577b9 100644 --- a/crates/wasmtime/src/runtime/coredump.rs +++ b/crates/wasmtime/src/runtime/coredump.rs @@ -1,9 +1,10 @@ +use crate::hash_map::HashMap; use crate::prelude::*; use crate::{ store::StoreOpaque, AsContextMut, FrameInfo, Global, HeapType, Instance, Memory, Module, StoreContextMut, Val, ValType, WasmBacktrace, }; -use std::{collections::HashMap, fmt}; +use std::fmt; /// Representation of a core dump of a WebAssembly module /// diff --git a/crates/wasmtime/src/runtime/linker.rs b/crates/wasmtime/src/runtime/linker.rs index 28a2c124b47..1bb0d83565a 100644 --- a/crates/wasmtime/src/runtime/linker.rs +++ b/crates/wasmtime/src/runtime/linker.rs @@ -1,4 +1,5 @@ use crate::func::HostFunc; +use crate::hash_map::{Entry, HashMap}; use crate::instance::InstancePre; use crate::store::StoreOpaque; use crate::{prelude::*, IntoFunc}; @@ -13,7 +14,6 @@ use core::future::Future; use core::marker; #[cfg(feature = "async")] use core::pin::Pin; -use hashbrown::hash_map::{Entry, HashMap}; use log::warn; /// Structure used to link wasm modules/instances together. diff --git a/crates/wasmtime/src/runtime/store.rs b/crates/wasmtime/src/runtime/store.rs index bf21c4a6513..dad9a1440d8 100644 --- a/crates/wasmtime/src/runtime/store.rs +++ b/crates/wasmtime/src/runtime/store.rs @@ -76,6 +76,7 @@ //! contents of `StoreOpaque`. This is an invariant that we, as the authors of //! `wasmtime`, must uphold for the public interface to be safe. +use crate::hash_set::HashSet; use crate::instance::InstanceData; use crate::linker::Definition; use crate::module::RegisteredModuleId; @@ -324,7 +325,7 @@ pub struct StoreOpaque { gc_roots: RootSet, gc_roots_list: GcRootsList, // Types for which the embedder has created an allocator for. - gc_host_alloc_types: hashbrown::HashSet, + gc_host_alloc_types: HashSet, // Numbers of resources instantiated in this store, and their limits instance_count: usize, @@ -542,7 +543,7 @@ impl Store { gc_store: None, gc_roots: RootSet::default(), gc_roots_list: GcRootsList::default(), - gc_host_alloc_types: hashbrown::HashSet::default(), + gc_host_alloc_types: HashSet::default(), modules: ModuleRegistry::default(), func_refs: FuncRefs::default(), host_globals: Vec::new(), diff --git a/crates/wasmtime/src/runtime/type_registry.rs b/crates/wasmtime/src/runtime/type_registry.rs index 611f579c98d..c18388ca359 100644 --- a/crates/wasmtime/src/runtime/type_registry.rs +++ b/crates/wasmtime/src/runtime/type_registry.rs @@ -3,6 +3,7 @@ //! Helps implement fast indirect call signature checking, reference type //! downcasting, and etc... +use crate::hash_set::HashSet; use crate::prelude::*; use crate::sync::RwLock; use crate::vm::GcRuntime; @@ -20,7 +21,6 @@ use core::{ Ordering::{AcqRel, Acquire}, }, }; -use hashbrown::HashSet; use wasmtime_environ::{ iter_entity_range, packed_option::PackedOption, EngineOrModuleTypeIndex, GcLayout, ModuleInternedTypeIndex, ModuleTypes, PrimaryMap, SecondaryMap, TypeTrace, VMSharedTypeIndex, diff --git a/crates/wasmtime/src/runtime/vm/gc/enabled/drc.rs b/crates/wasmtime/src/runtime/vm/gc/enabled/drc.rs index fedf2bb3c5a..959110da481 100644 --- a/crates/wasmtime/src/runtime/vm/gc/enabled/drc.rs +++ b/crates/wasmtime/src/runtime/vm/gc/enabled/drc.rs @@ -43,6 +43,7 @@ use super::free_list::FreeList; use super::{VMArrayRef, VMGcObjectDataMut, VMStructRef}; +use crate::hash_set::HashSet; use crate::prelude::*; use crate::runtime::vm::{ ExternRefHostDataId, ExternRefHostDataTable, GarbageCollection, GcHeap, GcHeapObject, @@ -57,7 +58,6 @@ use core::{ num::NonZeroUsize, ptr::{self, NonNull}, }; -use hashbrown::HashSet; use wasmtime_environ::drc::DrcTypeLayouts; use wasmtime_environ::{GcArrayLayout, GcStructLayout, GcTypeLayouts, VMGcKind, VMSharedTypeIndex}; diff --git a/crates/wasmtime/src/runtime/vm/gc/enabled/free_list.rs b/crates/wasmtime/src/runtime/vm/gc/enabled/free_list.rs index 85e766823d7..a348392ea94 100644 --- a/crates/wasmtime/src/runtime/vm/gc/enabled/free_list.rs +++ b/crates/wasmtime/src/runtime/vm/gc/enabled/free_list.rs @@ -314,7 +314,7 @@ fn round_usize_down_to_pow2(value: usize, divisor: usize) -> usize { mod tests { use super::*; use proptest::prelude::*; - use std::{collections::HashMap, num::NonZeroUsize}; + use std::num::NonZeroUsize; fn free_list_block_len_and_size(free_list: &FreeList) -> (usize, Option) { let len = free_list.free_block_index_to_len.len(); diff --git a/crates/wasmtime/src/runtime/vm/instance/allocator/pooling/index_allocator.rs b/crates/wasmtime/src/runtime/vm/instance/allocator/pooling/index_allocator.rs index 2b6cbb4dcc8..3536479856d 100644 --- a/crates/wasmtime/src/runtime/vm/instance/allocator/pooling/index_allocator.rs +++ b/crates/wasmtime/src/runtime/vm/instance/allocator/pooling/index_allocator.rs @@ -1,8 +1,8 @@ //! Index/slot allocator policies for the pooling allocator. +use crate::hash_map::{Entry, HashMap}; use crate::prelude::*; use crate::runtime::vm::CompiledModuleId; -use std::collections::hash_map::{Entry, HashMap}; use std::mem; use std::sync::Mutex; use wasmtime_environ::DefinedMemoryIndex;