From 053aee866cd4464542422369f2de40e9244e1fb3 Mon Sep 17 00:00:00 2001 From: "M.Amin Rayej" Date: Thu, 1 Feb 2024 02:12:32 +0330 Subject: [PATCH 1/2] migrate deprecated usage --- lib/cli/src/commands/create_exe.rs | 1 + lib/cli/src/store.rs | 1 + lib/middlewares/src/metering.rs | 5 ++--- tests/compilers/config.rs | 7 ++++--- tests/compilers/wast.rs | 2 +- 5 files changed, 9 insertions(+), 7 deletions(-) diff --git a/lib/cli/src/commands/create_exe.rs b/lib/cli/src/commands/create_exe.rs index b6714d49723..95022fff656 100644 --- a/lib/cli/src/commands/create_exe.rs +++ b/lib/cli/src/commands/create_exe.rs @@ -11,6 +11,7 @@ use anyhow::{anyhow, bail, Context, Result}; use clap::Parser; use serde::{Deserialize, Serialize}; use tar::Archive; +use wasmer::sys::Artifact; use wasmer::*; use wasmer_object::{emit_serialized, get_object_for_target}; use wasmer_types::{compilation::symbols::ModuleMetadataSymbolRegistry, ModuleInfo}; diff --git a/lib/cli/src/store.rs b/lib/cli/src/store.rs index 34d61d0f429..304f72615df 100644 --- a/lib/cli/src/store.rs +++ b/lib/cli/src/store.rs @@ -11,6 +11,7 @@ use std::string::ToString; use std::sync::Arc; use anyhow::{bail, Result}; +use wasmer::sys::Features; use wasmer::*; #[cfg(feature = "compiler")] use wasmer_compiler::CompilerConfig; diff --git a/lib/middlewares/src/metering.rs b/lib/middlewares/src/metering.rs index 3b32d83b5fd..acc30fed054 100644 --- a/lib/middlewares/src/metering.rs +++ b/lib/middlewares/src/metering.rs @@ -353,9 +353,8 @@ mod tests { use super::*; use std::sync::Arc; - use wasmer::{ - imports, wat2wasm, CompilerConfig, Cranelift, EngineBuilder, Module, Store, TypedFunction, - }; + use wasmer::sys::EngineBuilder; + use wasmer::{imports, wat2wasm, CompilerConfig, Cranelift, Module, Store, TypedFunction}; fn cost_function(operator: &Operator) -> u64 { match operator { diff --git a/tests/compilers/config.rs b/tests/compilers/config.rs index 82e0dabc258..96739558762 100644 --- a/tests/compilers/config.rs +++ b/tests/compilers/config.rs @@ -1,5 +1,6 @@ use std::sync::Arc; -use wasmer::{CompilerConfig, Features, ModuleMiddleware, Store}; +use wasmer::sys::Features; +use wasmer::{CompilerConfig, ModuleMiddleware, Store}; #[derive(Clone, Debug, PartialEq, Eq)] pub enum Compiler { @@ -50,7 +51,7 @@ impl Config { } pub fn engine(&self, compiler_config: Box) -> wasmer::Engine { - let mut engine = wasmer::EngineBuilder::new(compiler_config); + let mut engine = wasmer::sys::EngineBuilder::new(compiler_config); if let Some(ref features) = self.features { engine = engine.set_features(Some(features.clone())); } @@ -58,7 +59,7 @@ impl Config { } pub fn engine_headless(&self) -> wasmer::Engine { - wasmer::EngineBuilder::headless().engine().into() + wasmer::sys::EngineBuilder::headless().engine().into() } pub fn compiler_config( diff --git a/tests/compilers/wast.rs b/tests/compilers/wast.rs index 3c84fa26e0c..f79ceac5646 100644 --- a/tests/compilers/wast.rs +++ b/tests/compilers/wast.rs @@ -1,4 +1,4 @@ -use ::wasmer::Features; +use ::wasmer::sys::Features; use std::path::Path; use wasmer_wast::Wast; From 8557b3aaa6b04047086c0e009d098969ba17d071 Mon Sep 17 00:00:00 2001 From: "M.Amin Rayej" Date: Thu, 1 Feb 2024 02:50:17 +0330 Subject: [PATCH 2/2] gate the use statement --- lib/cli/src/store.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/cli/src/store.rs b/lib/cli/src/store.rs index 304f72615df..29cb24e9182 100644 --- a/lib/cli/src/store.rs +++ b/lib/cli/src/store.rs @@ -11,6 +11,7 @@ use std::string::ToString; use std::sync::Arc; use anyhow::{bail, Result}; +#[cfg(feature = "sys")] use wasmer::sys::Features; use wasmer::*; #[cfg(feature = "compiler")]