Repository: wasmerio/wasmer (language: rust)

Issue:
Remove deprecated methods
We have been warning of deprecation for some functions, we need to remove them in 5.0


Discussion / hints:

Fix patch:
diff --git a/Cargo.lock b/Cargo.lock
index f4a33d79c1a..50e7f7d4873 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1134,9 +1134,9 @@ dependencies = [
 
 [[package]]
 name = "critical-section"
-version = "1.1.2"
+version = "1.2.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7059fff8937831a9ae6f0fe4d658ffabf58f2ca96aa9dec1c889f936f705f216"
+checksum = "790eea4361631c5e7d22598ecd5723ff611904e3344ce8720784c93e3d83d40b"
 
 [[package]]
 name = "crossbeam-channel"
diff --git a/examples/engine.rs b/examples/engine.rs
index 1bb2001610f..754b43ba08d 100644
--- a/examples/engine.rs
+++ b/examples/engine.rs
@@ -18,7 +18,7 @@
 //!
 //! Ready?
 
-use wasmer::{imports, wat2wasm, EngineBuilder, Instance, Module, Store, Value};
+use wasmer::{imports, sys::EngineBuilder, wat2wasm, Instance, Module, Store, Value};
 use wasmer_compiler_cranelift::Cranelift;
 
 fn main() -> Result<(), Box<dyn std::error::Error>> {
diff --git a/examples/engine_cross_compilation.rs b/examples/engine_cross_compilation.rs
index 90216941823..3196c8f6394 100644
--- a/examples/engine_cross_compilation.rs
+++ b/examples/engine_cross_compilation.rs
@@ -19,7 +19,7 @@
 //! Ready?
 
 use std::str::FromStr;
-use wasmer::{wat2wasm, EngineBuilder, Module, RuntimeError, Store};
+use wasmer::{sys::EngineBuilder, wat2wasm, Module, RuntimeError, Store};
 use wasmer_compiler_cranelift::Cranelift;
 use wasmer_types::{CpuFeature, Target, Triple};
 
diff --git a/examples/engine_headless.rs b/examples/engine_headless.rs
index c0cbf2b334f..984bedecf9f 100644
--- a/examples/engine_headless.rs
+++ b/examples/engine_headless.rs
@@ -45,7 +45,7 @@
 //! Ready?
 
 use tempfile::NamedTempFile;
-use wasmer::{imports, wat2wasm, EngineBuilder, Instance, Module, Store, Value};
+use wasmer::{imports, sys::EngineBuilder, wat2wasm, Instance, Module, Store, Value};
 use wasmer_compiler_cranelift::Cranelift;
 
 fn main() -> Result<(), Box<dyn std::error::Error>> {
diff --git a/examples/features.rs b/examples/features.rs
index 28ea86e7e33..53830eace4f 100644
--- a/examples/features.rs
+++ b/examples/features.rs
@@ -10,7 +10,7 @@
 //!
 //! Ready?
 
-use wasmer::{imports, wat2wasm, EngineBuilder, Features, Instance, Module, Store, Value};
+use wasmer::{imports, sys::EngineBuilder, wat2wasm, Features, Instance, Module, Store, Value};
 use wasmer_compiler_cranelift::Cranelift;
 
 fn main() -> anyhow::Result<()> {
diff --git a/examples/metering.rs b/examples/metering.rs
index e5d8c70d742..2b5e78a0193 100644
--- a/examples/metering.rs
+++ b/examples/metering.rs
@@ -18,7 +18,7 @@ use anyhow::bail;
 use std::sync::Arc;
 use wasmer::wasmparser::Operator;
 use wasmer::CompilerConfig;
-use wasmer::{imports, wat2wasm, EngineBuilder, Instance, Module, Store, TypedFunction};
+use wasmer::{imports, sys::EngineBuilder, wat2wasm, Instance, Module, Store, TypedFunction};
 use wasmer_compiler_cranelift::Cranelift;
 use wasmer_middlewares::{
     metering::{get_remaining_points, set_remaining_points, MeteringPoints},
diff --git a/lib/api/src/js/vm.rs b/lib/api/src/js/vm.rs
index 12ed98ffe21..316e7d21f12 100644
--- a/lib/api/src/js/vm.rs
+++ b/lib/api/src/js/vm.rs
@@ -63,12 +63,6 @@ impl VMMemory {
         Ok(self.clone())
     }
 
-    /// Copies this memory to a new memory
-    #[deprecated = "use `copy` instead"]
-    pub fn duplicate(&mut self) -> Result<VMMemory, wasmer_types::MemoryError> {
-        self.copy()
-    }
-
     /// Copies this memory to a new memory
     pub fn copy(&mut self) -> Result<VMMemory, wasmer_types::MemoryError> {
         let new_memory = crate::js::externals::memory::Memory::js_memory_from_type(&self.ty)?;
diff --git a/lib/api/src/jsc/externals/memory.rs b/lib/api/src/jsc/externals/memory.rs
index bcb93618665..c0d9343c3be 100644
--- a/lib/api/src/jsc/externals/memory.rs
+++ b/lib/api/src/jsc/externals/memory.rs
@@ -208,7 +208,7 @@ impl Memory {
 
     #[allow(unused)]
     pub fn duplicate(&mut self, store: &impl AsStoreRef) -> Result<VMMemory, MemoryError> {
-        self.handle.duplicate(store)
+        self.handle.copy(store)
     }
 
     pub fn as_shared(&self, _store: &impl AsStoreRef) -> Option<crate::SharedMemory> {
diff --git a/lib/api/src/jsc/vm.rs b/lib/api/src/jsc/vm.rs
index c507625a495..ba29499176e 100644
--- a/lib/api/src/jsc/vm.rs
+++ b/lib/api/src/jsc/vm.rs
@@ -50,15 +50,6 @@ impl VMMemory {
         Ok(self.clone())
     }
 
-    /// Copies this memory to a new memory
-    #[deprecated = "use `copy` instead"]
-    pub fn duplicate(
-        &mut self,
-        store: &impl AsStoreRef,
-    ) -> Result<VMMemory, wasmer_types::MemoryError> {
-        self.copy(store)
-    }
-
     /// Copies this memory to a new memory
     pub fn copy(&self, store: &impl AsStoreRef) -> Result<VMMemory, wasmer_types::MemoryError> {
         let new_memory =
diff --git a/lib/api/src/lib.rs b/lib/api/src/lib.rs
index 2d9f5cd27eb..668098f68de 100644
--- a/lib/api/src/lib.rs
+++ b/lib/api/src/lib.rs
@@ -471,30 +471,6 @@ pub mod sys;
 /// Re-export `sys` definitions.
 pub use sys::*;
 
-#[cfg(feature = "sys")]
-#[deprecated(note = "wasmer::Artifact is deprecated, use wasmer::sys::Artifact instead")]
-/// A compiled wasm module, ready to be instantiated.
-pub type Artifact = sys::Artifact;
-#[cfg(feature = "sys")]
-#[deprecated(note = "wasmer::EngineBuilder is deprecated, use wasmer::sys::EngineBuilder instead")]
-/// The Builder contents of `Engine`
-pub type EngineBuilder = sys::EngineBuilder;
-#[cfg(feature = "sys")]
-#[deprecated(note = "wasmer::Features is deprecated, use wasmer::sys::Features instead")]
-/// Controls which experimental features will be enabled.
-pub type Features = sys::Features;
-#[cfg(feature = "sys")]
-#[deprecated(note = "wasmer::BaseTunables is deprecated, use wasmer::sys::BaseTunables instead")]
-/// Tunable parameters for WebAssembly compilation.
-/// This is the reference implementation of the `Tunables` trait,
-/// used by default.
-pub type BaseTunables = sys::BaseTunables;
-#[cfg(feature = "sys")]
-#[deprecated(note = "wasmer::VMConfig is deprecated, use wasmer::sys::VMConfig instead")]
-/// Configuration for the runtime VM
-/// Currently only the stack size is configurable
-pub type VMConfig = sys::VMConfig;
-
 #[cfg(feature = "js")]
 /// The `js` engine.
 mod js;
diff --git a/lib/compiler-cranelift/README.md b/lib/compiler-cranelift/README.md
index 625b51e744a..760cdf54b13 100644
--- a/lib/compiler-cranelift/README.md
+++ b/lib/compiler-cranelift/README.md
@@ -5,7 +5,7 @@ This crate contains a compiler implementation based on Cranelift.
 ## Usage
 
 ```rust
-use wasmer::{Store, EngineBuilder};
+use wasmer::{Store, sys::EngineBuilder};
 use wasmer_compiler_cranelift::Cranelift;
 
 let compiler = Cranelift::new();
diff --git a/lib/compiler-singlepass/README.md b/lib/compiler-singlepass/README.md
index ac49824fda1..6bbf623546c 100644
--- a/lib/compiler-singlepass/README.md
+++ b/lib/compiler-singlepass/README.md
@@ -5,7 +5,7 @@ This crate contains a compiler implementation based on the Singlepass linear com
 ## Usage
 
 ```rust
-use wasmer::{Store, EngineBuilder};
+use wasmer::{Store, sys::EngineBuilder};
 use wasmer_compiler_singlepass::Singlepass;
 
 let compiler = Singlepass::new();
diff --git a/lib/compiler/src/engine/artifact.rs b/lib/compiler/src/engine/artifact.rs
index d9a06b94cdd..f23d4a0409c 100644
--- a/lib/compiler/src/engine/artifact.rs
+++ b/lib/compiler/src/engine/artifact.rs
@@ -635,17 +635,6 @@ impl<'a> DataInitializerLocationLike for DataInitializerLocationVariant<'a> {
 }
 
 impl Artifact {
-    /// Register thie `Artifact` stack frame information into the global scope.
-    ///
-    /// This is not required anymore as it's done automaticaly when creating by 'Artifact::from_parts'
-    #[deprecated(
-        since = "4.0.0",
-        note = "done automaticaly by Artifact::from_parts, use 'take_frame_info_registration' if you use this method"
-    )]
-    pub fn register_frame_info(&mut self) -> Result<(), DeserializeError> {
-        self.internal_register_frame_info()
-    }
-
     fn internal_register_frame_info(&mut self) -> Result<(), DeserializeError> {
         if self
             .allocated
@@ -700,13 +689,6 @@ impl Artifact {
         Ok(())
     }
 
-    /// The GlobalFrameInfoRegistration needs to be transfered to EngineInner if
-    /// register_frame_info has been used.
-    #[deprecated(since = "4.0.0", note = "done automaticaly by Artifact::from_parts.")]
-    pub fn take_frame_info_registration(&mut self) -> Option<GlobalFrameInfoRegistration> {
-        self.internal_take_frame_info_registration()
-    }
-
     fn internal_take_frame_info_registration(&mut self) -> Option<GlobalFrameInfoRegistration> {
         let frame_info_registration = &mut self
             .allocated


Test patch: