diff --git a/lib/api/src/externals/function.rs b/lib/api/src/externals/function.rs index 6acefb7a8..6de013922 100644 --- a/lib/api/src/externals/function.rs +++ b/lib/api/src/externals/function.rs @@ -81,7 +81,7 @@ mod private { /// with native functions. Attempting to create a native `Function` with one will /// result in a panic. /// [Closures as host functions tracking issue](https://github.com/wasmerio/wasmer/issues/1840) -#[derive(Debug, Clone)] +#[derive(Debug, Clone, PartialEq)] pub struct Function(pub(crate) function_impl::Function); impl Function { @@ -500,6 +500,8 @@ impl Function { } } +impl std::cmp::Eq for Function {} + impl<'a> Exportable<'a> for Function { fn get_self_from_extern(_extern: &'a Extern) -> Result<&'a Self, ExportError> { match _extern { diff --git a/lib/api/src/externals/global.rs b/lib/api/src/externals/global.rs index 0fedb2bf0..2e9579e88 100644 --- a/lib/api/src/externals/global.rs +++ b/lib/api/src/externals/global.rs @@ -19,7 +19,7 @@ use crate::sys::externals::global as global_impl; /// It consists of an individual value and a flag indicating whether it is mutable. /// /// Spec: -#[derive(Debug, Clone)] +#[derive(Debug, Clone, PartialEq)] pub struct Global(pub(crate) global_impl::Global); impl Global { @@ -161,12 +161,6 @@ impl Global { } } -impl std::cmp::PartialEq for Global { - fn eq(&self, other: &Self) -> bool { - self.0 == other.0 - } -} - impl std::cmp::Eq for Global {} impl<'a> Exportable<'a> for Global { diff --git a/lib/api/src/externals/memory.rs b/lib/api/src/externals/memory.rs index cb14da8f6..5f725cc28 100644 --- a/lib/api/src/externals/memory.rs +++ b/lib/api/src/externals/memory.rs @@ -27,7 +27,7 @@ use wasmer_types::{MemoryError, Pages}; /// mutable from both host and WebAssembly. /// /// Spec: -#[derive(Debug, Clone)] +#[derive(Debug, Clone, PartialEq)] pub struct Memory(pub(crate) memory_impl::Memory); impl Memory { @@ -148,12 +148,6 @@ impl Memory { } } -impl std::cmp::PartialEq for Memory { - fn eq(&self, other: &Self) -> bool { - self.0 == other.0 - } -} - impl std::cmp::Eq for Memory {} impl<'a> Exportable<'a> for Memory { diff --git a/lib/api/src/externals/mod.rs b/lib/api/src/externals/mod.rs index ea207bcd2..5ac16b410 100644 --- a/lib/api/src/externals/mod.rs +++ b/lib/api/src/externals/mod.rs @@ -25,7 +25,7 @@ use crate::store::{AsStoreMut, AsStoreRef}; /// can be imported or exported. /// /// Spec: -#[derive(Clone)] +#[derive(Clone, PartialEq)] pub enum Extern { /// A external [`Function`]. Function(Function), diff --git a/lib/api/src/externals/table.rs b/lib/api/src/externals/table.rs index f21554fdd..873105016 100644 --- a/lib/api/src/externals/table.rs +++ b/lib/api/src/externals/table.rs @@ -20,7 +20,7 @@ use crate::Value; /// mutable from both host and WebAssembly. /// /// Spec: -#[derive(Debug, Clone)] +#[derive(Debug, Clone, PartialEq)] pub struct Table(pub(crate) table_impl::Table); impl Table { @@ -113,12 +113,6 @@ impl Table { } } -impl std::cmp::PartialEq for Table { - fn eq(&self, other: &Self) -> bool { - self.0 == other.0 - } -} - impl std::cmp::Eq for Table {} impl<'a> Exportable<'a> for Table { diff --git a/lib/api/src/imports.rs b/lib/api/src/imports.rs index f0b4f231c..f50b2c2e7 100644 --- a/lib/api/src/imports.rs +++ b/lib/api/src/imports.rs @@ -304,7 +304,7 @@ macro_rules! import_namespace { #[cfg(test)] mod test { - use crate::store::{AsStoreMut, Store}; + use crate::store::Store; use crate::value::Value; use crate::Extern; use crate::Global; diff --git a/lib/api/src/js/externals/table.rs b/lib/api/src/js/externals/table.rs index 41a6e876a..715829ccc 100644 --- a/lib/api/src/js/externals/table.rs +++ b/lib/api/src/js/externals/table.rs @@ -23,7 +23,7 @@ fn get_function(store: &mut impl AsStoreMut, val: Value) -> Result Ok(func.0.handle.function.clone().into()), // Only funcrefs is supported by the spec atm - _ => unimplemented!(), + _ => unimplemented!("The {val:?} is not yet supported"), } } diff --git a/lib/api/src/sys/externals/function.rs b/lib/api/src/sys/externals/function.rs index 918737489..47f59b805 100644 --- a/lib/api/src/sys/externals/function.rs +++ b/lib/api/src/sys/externals/function.rs @@ -14,7 +14,7 @@ use wasmer_vm::{ VMFunction, VMFunctionBody, VMFunctionContext, VMFunctionKind, VMTrampoline, }; -#[derive(Debug, Clone)] +#[derive(Debug, Clone, PartialEq)] pub struct Function { pub(crate) handle: StoreHandle, } diff --git a/lib/api/src/sys/tunables.rs b/lib/api/src/sys/tunables.rs index 0e7946b82..cc26e64b3 100644 --- a/lib/api/src/sys/tunables.rs +++ b/lib/api/src/sys/tunables.rs @@ -228,7 +228,7 @@ mod tests { #[test] fn check_customtunables() -> Result<(), Box> { - use crate::{imports, wat2wasm, Instance, Memory, Module, Store}; + use crate::{imports, wat2wasm, Engine, Instance, Memory, Module, Store}; use wasmer_compiler_cranelift::Cranelift; let wasm_bytes = wat2wasm( @@ -242,7 +242,9 @@ mod tests { let compiler = Cranelift::default(); let tunables = TinyTunables {}; - let mut store = Store::new_with_tunables(compiler, tunables); + let mut engine = Engine::new(compiler.into(), Default::default(), Default::default()); + engine.set_tunables(tunables); + let mut store = Store::new(engine); //let mut store = Store::new(compiler); let module = Module::new(&store, wasm_bytes)?; let import_object = imports! {};