diff --git a/crates/cli/src/main.rs b/crates/cli/src/main.rs index 91fd661c21..a5bd5edacc 100644 --- a/crates/cli/src/main.rs +++ b/crates/cli/src/main.rs @@ -7,11 +7,12 @@ use std::{ path::{Path, PathBuf}, }; use wasmi::{ - core::{Value, ValueType, F32, F64}, + core::{ValueType, F32, F64}, ExternType, Func, FuncType, Store, + Value, }; /// Simple program to greet a person diff --git a/crates/core/src/lib.rs b/crates/core/src/lib.rs index c46bbc5801..3a55b05d18 100644 --- a/crates/core/src/lib.rs +++ b/crates/core/src/lib.rs @@ -41,5 +41,5 @@ pub use self::{ trap::{Trap, TrapCode}, units::Pages, untyped::{DecodeUntypedSlice, EncodeUntypedSlice, UntypedError, UntypedValue}, - value::{TryFromValueError, Value, ValueType}, + value::ValueType, }; diff --git a/crates/core/src/untyped.rs b/crates/core/src/untyped.rs index e7ffae6777..c0befd1299 100644 --- a/crates/core/src/untyped.rs +++ b/crates/core/src/untyped.rs @@ -8,8 +8,6 @@ use crate::{ TrapCode, TruncateSaturateInto, TryTruncateInto, - Value, - ValueType, WrapInto, F32, F64, @@ -20,7 +18,7 @@ use core::{ }; use paste::paste; -/// An untyped [`Value`]. +/// An untyped value. /// /// Provides a dense and simple interface to all functional Wasm operations. #[derive(Debug, Copy, Clone, Default, PartialEq, Eq, PartialOrd, Ord)] @@ -36,16 +34,6 @@ impl UntypedValue { pub fn to_bits(self) -> u64 { self.bits } - - /// Converts the [`UntypedValue`] into a [`Value`]. - pub fn with_type(self, value_type: ValueType) -> Value { - match value_type { - ValueType::I32 => Value::I32(<_>::from(self)), - ValueType::I64 => Value::I64(<_>::from(self)), - ValueType::F32 => Value::F32(<_>::from(self)), - ValueType::F64 => Value::F64(<_>::from(self)), - } - } } macro_rules! impl_from_untyped_for_int { @@ -80,17 +68,6 @@ impl From for bool { } } -impl From for UntypedValue { - fn from(value: Value) -> Self { - match value { - Value::I32(value) => value.into(), - Value::I64(value) => value.into(), - Value::F32(value) => value.into(), - Value::F64(value) => value.into(), - } - } -} - macro_rules! impl_from_unsigned_prim { ( $( $prim:ty ),* $(,)? ) => { $( diff --git a/crates/core/src/value.rs b/crates/core/src/value.rs index 81fdd3d2ec..8005049108 100644 --- a/crates/core/src/value.rs +++ b/crates/core/src/value.rs @@ -32,36 +32,6 @@ impl Display for ValueType { } } -/// Runtime representation of a value. -/// -/// Wasm code manipulate values of the four basic value types: -/// integers and floating-point (IEEE 754-2008) data of 32 or 64 bit width each, respectively. -/// -/// There is no distinction between signed and unsigned integer types. Instead, integers are -/// interpreted by respective operations as either unsigned or signed in two’s complement representation. -#[derive(Copy, Clone, Debug, PartialEq)] -pub enum Value { - /// Value of 32-bit signed or unsigned integer. - I32(i32), - /// Value of 64-bit signed or unsigned integer. - I64(i64), - /// Value of 32-bit IEEE 754-2008 floating point number. - F32(F32), - /// Value of 64-bit IEEE 754-2008 floating point number. - F64(F64), -} - -impl Display for Value { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self { - Self::I32(value) => write!(f, "{value}"), - Self::I64(value) => write!(f, "{value}"), - Self::F32(value) => write!(f, "{}", f32::from(*value)), - Self::F64(value) => write!(f, "{}", f64::from(*value)), - } - } -} - /// Convert one type to another by wrapping. pub trait WrapInto { /// Convert one type to another by wrapping. @@ -242,241 +212,6 @@ pub trait Float: ArithmeticOps { fn copysign(self, other: T) -> T; } -impl Value { - /// Creates new default value of given type. - #[inline] - pub fn default(value_type: ValueType) -> Self { - match value_type { - ValueType::I32 => Value::I32(0), - ValueType::I64 => Value::I64(0), - ValueType::F32 => Value::F32(0f32.into()), - ValueType::F64 => Value::F64(0f64.into()), - } - } - - /// Get variable type for this value. - #[inline] - pub fn ty(&self) -> ValueType { - match *self { - Value::I32(_) => ValueType::I32, - Value::I64(_) => ValueType::I64, - Value::F32(_) => ValueType::F32, - Value::F64(_) => ValueType::F64, - } - } - - /// Returns `T` if this particular [`Value`] contains - /// appropriate type. - /// - /// See [`FromValue`] for details. - /// - /// [`FromValue`]: trait.FromValue.html - /// [`Value`]: enum.Value.html - #[inline] - pub fn try_into>(self) -> Option { - >::try_from(self).ok() - } -} - -impl From for Value { - #[inline] - fn from(val: i8) -> Self { - Value::I32(val.into()) - } -} - -impl From for Value { - #[inline] - fn from(val: i16) -> Self { - Value::I32(val.into()) - } -} - -impl From for Value { - #[inline] - fn from(val: i32) -> Self { - Value::I32(val) - } -} - -impl From for Value { - #[inline] - fn from(val: i64) -> Self { - Value::I64(val) - } -} - -impl From for Value { - #[inline] - fn from(val: u8) -> Self { - Value::I32(val.into()) - } -} - -impl From for Value { - #[inline] - fn from(val: u16) -> Self { - Value::I32(val.into()) - } -} - -impl From for Value { - #[inline] - fn from(val: u32) -> Self { - Value::I32(val.transmute_into()) - } -} - -impl From for Value { - #[inline] - fn from(val: u64) -> Self { - Value::I64(val.transmute_into()) - } -} - -impl From for Value { - #[inline] - fn from(val: F32) -> Self { - Value::F32(val) - } -} - -impl From for Value { - #[inline] - fn from(val: F64) -> Self { - Value::F64(val) - } -} - -macro_rules! impl_from_value { - ($expected_rt_ty: ident, $into: ty) => { - impl TryFrom for $into { - type Error = TryFromValueError; - - #[inline] - fn try_from(val: Value) -> Result { - match val { - Value::$expected_rt_ty(val) => Ok(val.transmute_into()), - _ => Err(Self::Error::TypeMismatch), - } - } - } - }; -} - -/// Errors that may occur upon converting a [`Value`] to a primitive type. -#[derive(Debug, Copy, Clone)] -pub enum TryFromValueError { - /// The type does not match the expected type. - TypeMismatch, - /// The value is out of bounds for the expected type. - OutOfBounds, -} - -impl Display for TryFromValueError { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - match self { - TryFromValueError::TypeMismatch => write!(f, "encountered type mismatch"), - TryFromValueError::OutOfBounds => write!(f, "value out of bounds"), - } - } -} - -/// This conversion assumes that boolean values are represented by -/// [`I32`] type. -/// -/// [`I32`]: enum.Value.html#variant.I32 -impl TryFrom for bool { - type Error = TryFromValueError; - - #[inline] - fn try_from(val: Value) -> Result { - match val { - Value::I32(val) => Ok(val != 0), - _ => Err(Self::Error::TypeMismatch), - } - } -} - -/// This conversion assumes that `i8` is represented as an [`I32`]. -/// -/// [`I32`]: enum.Value.html#variant.I32 -impl TryFrom for i8 { - type Error = TryFromValueError; - - #[inline] - fn try_from(val: Value) -> Result { - let min = i32::from(i8::MIN); - let max = i32::from(i8::MAX); - match val { - Value::I32(val) if min <= val && val <= max => Ok(val as i8), - Value::I32(_) => Err(Self::Error::OutOfBounds), - _ => Err(Self::Error::TypeMismatch), - } - } -} - -/// This conversion assumes that `i16` is represented as an [`I32`]. -/// -/// [`I32`]: enum.Value.html#variant.I32 -impl TryFrom for i16 { - type Error = TryFromValueError; - - #[inline] - fn try_from(val: Value) -> Result { - let min = i32::from(i16::MIN); - let max = i32::from(i16::MAX); - match val { - Value::I32(val) if min <= val && val <= max => Ok(val as i16), - Value::I32(_) => Err(Self::Error::OutOfBounds), - _ => Err(Self::Error::TypeMismatch), - } - } -} - -/// This conversion assumes that `u8` is represented as an [`I32`]. -/// -/// [`I32`]: enum.Value.html#variant.I32 -impl TryFrom for u8 { - type Error = TryFromValueError; - - #[inline] - fn try_from(val: Value) -> Result { - let min = i32::from(u8::MIN); - let max = i32::from(u8::MAX); - match val { - Value::I32(val) if min <= val && val <= max => Ok(val as u8), - Value::I32(_) => Err(Self::Error::OutOfBounds), - _ => Err(Self::Error::TypeMismatch), - } - } -} - -/// This conversion assumes that `u16` is represented as an [`I32`]. -/// -/// [`I32`]: enum.Value.html#variant.I32 -impl TryFrom for u16 { - type Error = TryFromValueError; - - #[inline] - fn try_from(val: Value) -> Result { - let min = i32::from(u16::MIN); - let max = i32::from(u16::MAX); - match val { - Value::I32(val) if min <= val && val <= max => Ok(val as u16), - Value::I32(_) => Err(Self::Error::OutOfBounds), - _ => Err(Self::Error::TypeMismatch), - } - } -} - -impl_from_value!(I32, i32); -impl_from_value!(I64, i64); -impl_from_value!(F32, F32); -impl_from_value!(F64, F64); -impl_from_value!(I32, u32); -impl_from_value!(I64, u64); - macro_rules! impl_wrap_into { ($from:ident, $into:ident) => { impl WrapInto<$into> for $from { diff --git a/crates/wasmi/benches/benches.rs b/crates/wasmi/benches/benches.rs index 2acdcfc154..10694009a8 100644 --- a/crates/wasmi/benches/benches.rs +++ b/crates/wasmi/benches/benches.rs @@ -9,16 +9,7 @@ use self::bench::{ }; use criterion::{criterion_group, criterion_main, Bencher, Criterion}; use std::{slice, time::Duration}; -use wasmi::{ - core::{TrapCode, Value}, - Engine, - Extern, - Func, - Linker, - Memory, - Module, - Store, -}; +use wasmi::{core::TrapCode, Engine, Extern, Func, Linker, Memory, Module, Store, Value}; use wasmi_core::{Pages, ValueType, F32, F64}; criterion_group!( diff --git a/crates/wasmi/src/engine/func_builder/mod.rs b/crates/wasmi/src/engine/func_builder/mod.rs index c832b729d1..473133e964 100644 --- a/crates/wasmi/src/engine/func_builder/mod.rs +++ b/crates/wasmi/src/engine/func_builder/mod.rs @@ -43,9 +43,10 @@ use crate::{ Engine, FuncType, Mutability, + Value, }; use alloc::vec::Vec; -use wasmi_core::{Value, ValueType, F32, F64}; +use wasmi_core::{ValueType, F32, F64}; /// The used function validator type. type FuncValidator = wasmparser::FuncValidator; diff --git a/crates/wasmi/src/engine/resumable.rs b/crates/wasmi/src/engine/resumable.rs index 5c9bda7678..1d2cbcf4e9 100644 --- a/crates/wasmi/src/engine/resumable.rs +++ b/crates/wasmi/src/engine/resumable.rs @@ -1,7 +1,15 @@ use super::Func; -use crate::{engine::Stack, func::CallResultsTuple, AsContextMut, Engine, Error, WasmResults}; +use crate::{ + engine::Stack, + func::CallResultsTuple, + AsContextMut, + Engine, + Error, + Value, + WasmResults, +}; use core::{fmt, marker::PhantomData, mem::replace, ops::Deref}; -use wasmi_core::{Trap, Value}; +use wasmi_core::Trap; /// Returned by [`Engine`] methods for calling a function in a resumable way. /// diff --git a/crates/wasmi/src/engine/traits.rs b/crates/wasmi/src/engine/traits.rs index b85cf39040..09530fbcf4 100644 --- a/crates/wasmi/src/engine/traits.rs +++ b/crates/wasmi/src/engine/traits.rs @@ -1,4 +1,4 @@ -use crate::core::Value; +use crate::{value::WithType, Value}; use core::{iter, slice}; use wasmi_core::UntypedValue; diff --git a/crates/wasmi/src/func/mod.rs b/crates/wasmi/src/func/mod.rs index 33b24c6538..4a780606ae 100644 --- a/crates/wasmi/src/func/mod.rs +++ b/crates/wasmi/src/func/mod.rs @@ -18,12 +18,7 @@ use super::{ StoreContext, Stored, }; -use crate::{ - core::{Trap, Value}, - engine::ResumableCall, - Error, - FuncType, -}; +use crate::{core::Trap, engine::ResumableCall, Error, FuncType, Value}; use alloc::sync::Arc; use core::{fmt, fmt::Debug}; use wasmi_arena::ArenaIndex; diff --git a/crates/wasmi/src/func_type.rs b/crates/wasmi/src/func_type.rs index 3b3847a4a1..aa0d4c6918 100644 --- a/crates/wasmi/src/func_type.rs +++ b/crates/wasmi/src/func_type.rs @@ -1,7 +1,6 @@ -use crate::{core::ValueType, func::FuncError}; +use crate::{core::ValueType, func::FuncError, Value}; use alloc::{sync::Arc, vec::Vec}; use core::fmt::{self, Display}; -use wasmi_core::Value; /// A function type representing a function's parameter and result types. /// diff --git a/crates/wasmi/src/global.rs b/crates/wasmi/src/global.rs index d71f7b410a..7acb7cb2e2 100644 --- a/crates/wasmi/src/global.rs +++ b/crates/wasmi/src/global.rs @@ -1,5 +1,5 @@ use super::{AsContext, AsContextMut, Stored}; -use crate::core::{Value, ValueType}; +use crate::{core::ValueType, value::WithType, Value}; use core::{fmt, fmt::Display, ptr::NonNull}; use wasmi_arena::ArenaIndex; use wasmi_core::UntypedValue; diff --git a/crates/wasmi/src/lib.rs b/crates/wasmi/src/lib.rs index fc75bba46e..30ab771c79 100644 --- a/crates/wasmi/src/lib.rs +++ b/crates/wasmi/src/lib.rs @@ -100,6 +100,7 @@ mod memory; mod module; mod store; mod table; +mod value; /// Definitions from the `wasmi_core` crate. #[doc(inline)] @@ -165,4 +166,5 @@ pub use self::{ }, store::{AsContext, AsContextMut, Store, StoreContext, StoreContextMut}, table::{Table, TableType}, + value::Value, }; diff --git a/crates/wasmi/src/module/init_expr.rs b/crates/wasmi/src/module/init_expr.rs index 3efbb64696..a73cf88109 100644 --- a/crates/wasmi/src/module/init_expr.rs +++ b/crates/wasmi/src/module/init_expr.rs @@ -1,6 +1,6 @@ use super::{FuncIdx, GlobalIdx}; -use crate::errors::ModuleError; -use wasmi_core::{Value, F32, F64}; +use crate::{errors::ModuleError, Value}; +use wasmi_core::{F32, F64}; /// An initializer expression. /// diff --git a/crates/wasmi/src/module/instantiate/mod.rs b/crates/wasmi/src/module/instantiate/mod.rs index 6e28a03b7e..9b59debed0 100644 --- a/crates/wasmi/src/module/instantiate/mod.rs +++ b/crates/wasmi/src/module/instantiate/mod.rs @@ -22,8 +22,8 @@ use crate::{ InstanceEntityBuilder, Memory, Table, + Value, }; -use wasmi_core::Value; impl Module { /// Instantiates a new [`Instance`] from the given compiled [`Module`]. diff --git a/crates/wasmi/src/value.rs b/crates/wasmi/src/value.rs new file mode 100644 index 0000000000..cb67e071d0 --- /dev/null +++ b/crates/wasmi/src/value.rs @@ -0,0 +1,299 @@ +use core::{fmt, fmt::Display}; +use wasmi_core::{UntypedValue, ValueType, F32, F64}; + +/// Untyped instances that allow to be typed. +pub trait WithType { + /// The typed output type. + type Output; + + /// Converts `self` to [`Self::Output`] using `ty`. + fn with_type(self, ty: ValueType) -> Self::Output; +} + +impl WithType for UntypedValue { + type Output = Value; + + fn with_type(self, ty: ValueType) -> Self::Output { + match ty { + ValueType::I32 => Value::I32(self.into()), + ValueType::I64 => Value::I64(self.into()), + ValueType::F32 => Value::F32(self.into()), + ValueType::F64 => Value::F64(self.into()), + } + } +} + +impl From for UntypedValue { + fn from(value: Value) -> Self { + match value { + Value::I32(value) => value.into(), + Value::I64(value) => value.into(), + Value::F32(value) => value.into(), + Value::F64(value) => value.into(), + } + } +} + +/// Runtime representation of a value. +/// +/// Wasm code manipulate values of the four basic value types: +/// integers and floating-point (IEEE 754-2008) data of 32 or 64 bit width each, respectively. +/// +/// There is no distinction between signed and unsigned integer types. Instead, integers are +/// interpreted by respective operations as either unsigned or signed in two’s complement representation. +#[derive(Copy, Clone, Debug, PartialEq)] +pub enum Value { + /// Value of 32-bit signed or unsigned integer. + I32(i32), + /// Value of 64-bit signed or unsigned integer. + I64(i64), + /// Value of 32-bit IEEE 754-2008 floating point number. + F32(F32), + /// Value of 64-bit IEEE 754-2008 floating point number. + F64(F64), +} + +impl Display for Value { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match self { + Self::I32(value) => write!(f, "{value}"), + Self::I64(value) => write!(f, "{value}"), + Self::F32(value) => write!(f, "{}", f32::from(*value)), + Self::F64(value) => write!(f, "{}", f64::from(*value)), + } + } +} + +impl Value { + /// Creates new default value of given type. + #[inline] + pub fn default(value_type: ValueType) -> Self { + match value_type { + ValueType::I32 => Value::I32(0), + ValueType::I64 => Value::I64(0), + ValueType::F32 => Value::F32(0f32.into()), + ValueType::F64 => Value::F64(0f64.into()), + } + } + + /// Get variable type for this value. + #[inline] + pub fn ty(&self) -> ValueType { + match *self { + Value::I32(_) => ValueType::I32, + Value::I64(_) => ValueType::I64, + Value::F32(_) => ValueType::F32, + Value::F64(_) => ValueType::F64, + } + } + + /// Returns `T` if this particular [`Value`] contains + /// appropriate type. + /// + /// See [`FromValue`] for details. + /// + /// [`FromValue`]: trait.FromValue.html + /// [`Value`]: enum.Value.html + #[inline] + pub fn try_into>(self) -> Option { + >::try_from(self).ok() + } +} + +impl From for Value { + #[inline] + fn from(val: i8) -> Self { + Value::I32(val.into()) + } +} + +impl From for Value { + #[inline] + fn from(val: i16) -> Self { + Value::I32(val.into()) + } +} + +impl From for Value { + #[inline] + fn from(val: i32) -> Self { + Value::I32(val) + } +} + +impl From for Value { + #[inline] + fn from(val: i64) -> Self { + Value::I64(val) + } +} + +impl From for Value { + #[inline] + fn from(val: u8) -> Self { + Value::I32(val.into()) + } +} + +impl From for Value { + #[inline] + fn from(val: u16) -> Self { + Value::I32(val.into()) + } +} + +impl From for Value { + #[inline] + fn from(val: u32) -> Self { + Value::I32(val as _) + } +} + +impl From for Value { + #[inline] + fn from(val: u64) -> Self { + Value::I64(val as _) + } +} + +impl From for Value { + #[inline] + fn from(val: F32) -> Self { + Value::F32(val) + } +} + +impl From for Value { + #[inline] + fn from(val: F64) -> Self { + Value::F64(val) + } +} + +macro_rules! impl_from_value { + ($expected_rt_ty: ident, $into: ty) => { + impl TryFrom for $into { + type Error = TryFromValueError; + + #[inline] + fn try_from(val: Value) -> Result { + match val { + Value::$expected_rt_ty(val) => Ok(val as _), + _ => Err(Self::Error::TypeMismatch), + } + } + } + }; +} +impl_from_value!(I32, i32); +impl_from_value!(I64, i64); +impl_from_value!(F32, F32); +impl_from_value!(F64, F64); +impl_from_value!(I32, u32); +impl_from_value!(I64, u64); + +/// Errors that may occur upon converting a [`Value`] to a primitive type. +#[derive(Debug, Copy, Clone)] +pub enum TryFromValueError { + /// The type does not match the expected type. + TypeMismatch, + /// The value is out of bounds for the expected type. + OutOfBounds, +} + +impl Display for TryFromValueError { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + TryFromValueError::TypeMismatch => write!(f, "encountered type mismatch"), + TryFromValueError::OutOfBounds => write!(f, "value out of bounds"), + } + } +} + +/// This conversion assumes that boolean values are represented by +/// [`I32`] type. +/// +/// [`I32`]: enum.Value.html#variant.I32 +impl TryFrom for bool { + type Error = TryFromValueError; + + #[inline] + fn try_from(val: Value) -> Result { + match val { + Value::I32(val) => Ok(val != 0), + _ => Err(Self::Error::TypeMismatch), + } + } +} + +/// This conversion assumes that `i8` is represented as an [`I32`]. +/// +/// [`I32`]: enum.Value.html#variant.I32 +impl TryFrom for i8 { + type Error = TryFromValueError; + + #[inline] + fn try_from(val: Value) -> Result { + let min = i32::from(i8::MIN); + let max = i32::from(i8::MAX); + match val { + Value::I32(val) if min <= val && val <= max => Ok(val as i8), + Value::I32(_) => Err(Self::Error::OutOfBounds), + _ => Err(Self::Error::TypeMismatch), + } + } +} + +/// This conversion assumes that `i16` is represented as an [`I32`]. +/// +/// [`I32`]: enum.Value.html#variant.I32 +impl TryFrom for i16 { + type Error = TryFromValueError; + + #[inline] + fn try_from(val: Value) -> Result { + let min = i32::from(i16::MIN); + let max = i32::from(i16::MAX); + match val { + Value::I32(val) if min <= val && val <= max => Ok(val as i16), + Value::I32(_) => Err(Self::Error::OutOfBounds), + _ => Err(Self::Error::TypeMismatch), + } + } +} + +/// This conversion assumes that `u8` is represented as an [`I32`]. +/// +/// [`I32`]: enum.Value.html#variant.I32 +impl TryFrom for u8 { + type Error = TryFromValueError; + + #[inline] + fn try_from(val: Value) -> Result { + let min = i32::from(u8::MIN); + let max = i32::from(u8::MAX); + match val { + Value::I32(val) if min <= val && val <= max => Ok(val as u8), + Value::I32(_) => Err(Self::Error::OutOfBounds), + _ => Err(Self::Error::TypeMismatch), + } + } +} + +/// This conversion assumes that `u16` is represented as an [`I32`]. +/// +/// [`I32`]: enum.Value.html#variant.I32 +impl TryFrom for u16 { + type Error = TryFromValueError; + + #[inline] + fn try_from(val: Value) -> Result { + let min = i32::from(u16::MIN); + let max = i32::from(u16::MAX); + match val { + Value::I32(val) if min <= val && val <= max => Ok(val as u16), + Value::I32(_) => Err(Self::Error::OutOfBounds), + _ => Err(Self::Error::TypeMismatch), + } + } +} diff --git a/crates/wasmi/tests/e2e/v1/func.rs b/crates/wasmi/tests/e2e/v1/func.rs index 2578e968b9..7598e25d7b 100644 --- a/crates/wasmi/tests/e2e/v1/func.rs +++ b/crates/wasmi/tests/e2e/v1/func.rs @@ -1,8 +1,8 @@ //! Tests for the `Func` type in `wasmi`. use assert_matches::assert_matches; -use wasmi::{errors::FuncError, Engine, Error, Func, Store}; -use wasmi_core::{Value, F32, F64}; +use wasmi::{errors::FuncError, Engine, Error, Func, Store, Value}; +use wasmi_core::{F32, F64}; fn test_setup() -> Store<()> { let engine = Engine::default(); diff --git a/crates/wasmi/tests/e2e/v1/resumable_call.rs b/crates/wasmi/tests/e2e/v1/resumable_call.rs index 316e48bafe..cfae960d90 100644 --- a/crates/wasmi/tests/e2e/v1/resumable_call.rs +++ b/crates/wasmi/tests/e2e/v1/resumable_call.rs @@ -12,8 +12,9 @@ use wasmi::{ Store, TypedResumableCall, TypedResumableInvocation, + Value, }; -use wasmi_core::{Trap, TrapCode, Value, ValueType}; +use wasmi_core::{Trap, TrapCode, ValueType}; fn test_setup() -> Store<()> { let engine = Engine::default(); diff --git a/crates/wasmi/tests/spec/context.rs b/crates/wasmi/tests/spec/context.rs index 56b7d6ad35..78c0d02303 100644 --- a/crates/wasmi/tests/spec/context.rs +++ b/crates/wasmi/tests/spec/context.rs @@ -16,8 +16,9 @@ use wasmi::{ Store, Table, TableType, + Value, }; -use wasmi_core::{Value, F32, F64}; +use wasmi_core::{F32, F64}; use wast::token::{Id, Span}; /// The context of a single Wasm test spec suite run. diff --git a/crates/wasmi/tests/spec/run.rs b/crates/wasmi/tests/spec/run.rs index cc0f9e3996..b04ba6a389 100644 --- a/crates/wasmi/tests/spec/run.rs +++ b/crates/wasmi/tests/spec/run.rs @@ -1,7 +1,7 @@ use super::{error::TestError, TestContext, TestDescriptor}; use anyhow::Result; -use wasmi::Config; -use wasmi_core::{Value, F32, F64}; +use wasmi::{Config, Value}; +use wasmi_core::{F32, F64}; use wast::{ core::{NanPattern, WastRetCore}, lexer::Lexer,