diff --git a/examples/engine_headless.rs b/examples/engine_headless.rs index 6e2e1c3ea..40b4881d6 100644 --- a/examples/engine_headless.rs +++ b/examples/engine_headless.rs @@ -77,7 +77,7 @@ fn main() -> Result<(), Box> { // In this situation, the compiler is // `wasmer_compiler_cranelift`. The compiler is responsible to // compile the Wasm module into executable code. - let mut compiler_config = Cranelift::default(); + let compiler_config = Cranelift::default(); println!("Creating Native engine..."); // Define the engine that will drive everything. diff --git a/examples/engine_native.rs b/examples/engine_native.rs index a35314f42..3345d0e5b 100644 --- a/examples/engine_native.rs +++ b/examples/engine_native.rs @@ -43,7 +43,7 @@ fn main() -> Result<(), Box> { // In this situation, the compiler is // `wasmer_compiler_cranelift`. The compiler is responsible to // compile the Wasm module into executable code. - let mut compiler_config = Cranelift::default(); + let compiler_config = Cranelift::default(); println!("Creating Native engine..."); // Define the engine that will drive everything. diff --git a/lib/api/src/store.rs b/lib/api/src/store.rs index d72da245c..6a5517e38 100644 --- a/lib/api/src/store.rs +++ b/lib/api/src/store.rs @@ -80,7 +80,7 @@ impl Default for Store { // sure this function doesn't emit a compile error even if // more than one compiler is enabled. #[allow(unreachable_code)] - fn get_config() -> impl CompilerConfig + Send + Sync + 'static { + fn get_config() -> impl CompilerConfig + 'static { cfg_if::cfg_if! { if #[cfg(feature = "default-cranelift")] { wasmer_compiler_cranelift::Cranelift::default() @@ -96,7 +96,7 @@ impl Default for Store { #[allow(unreachable_code, unused_mut)] fn get_engine( - mut config: impl CompilerConfig + Send + Sync + 'static, + mut config: impl CompilerConfig + 'static, ) -> impl Engine + Send + Sync { cfg_if::cfg_if! { if #[cfg(feature = "default-jit")] { diff --git a/lib/compiler-cranelift/src/config.rs b/lib/compiler-cranelift/src/config.rs index a81e64aef..c4f8bdf65 100644 --- a/lib/compiler-cranelift/src/config.rs +++ b/lib/compiler-cranelift/src/config.rs @@ -194,7 +194,7 @@ impl CompilerConfig for Cranelift { } /// Transform it into the compiler - fn compiler(self: Box) -> Box { + fn compiler(self: Box) -> Box { Box::new(CraneliftCompiler::new(*self)) } diff --git a/lib/compiler-llvm/src/config.rs b/lib/compiler-llvm/src/config.rs index aa8225af0..1d1d5224d 100644 --- a/lib/compiler-llvm/src/config.rs +++ b/lib/compiler-llvm/src/config.rs @@ -207,7 +207,7 @@ impl CompilerConfig for LLVM { } /// Transform it into the compiler. - fn compiler(self: Box) -> Box { + fn compiler(self: Box) -> Box { Box::new(LLVMCompiler::new(*self)) } diff --git a/lib/compiler-singlepass/src/config.rs b/lib/compiler-singlepass/src/config.rs index d72135f09..669b8be07 100644 --- a/lib/compiler-singlepass/src/config.rs +++ b/lib/compiler-singlepass/src/config.rs @@ -54,7 +54,7 @@ impl CompilerConfig for Singlepass { } /// Transform it into the compiler - fn compiler(self: Box) -> Box { + fn compiler(self: Box) -> Box { Box::new(SinglepassCompiler::new(*self)) } diff --git a/lib/compiler/README.md b/lib/compiler/README.md index dd6a60d3f..d7eb3b8d1 100644 --- a/lib/compiler/README.md +++ b/lib/compiler/README.md @@ -23,7 +23,7 @@ To create a compiler, one needs to implement two traits: /// The compiler configuration options. pub trait CompilerConfig { /// Gets the custom compiler config - fn compiler(&self) -> Box; + fn compiler(&self) -> Box; } /// An implementation of a compiler from parsed WebAssembly module to compiled native code. diff --git a/lib/compiler/src/compiler.rs b/lib/compiler/src/compiler.rs index 127290198..d695c661a 100644 --- a/lib/compiler/src/compiler.rs +++ b/lib/compiler/src/compiler.rs @@ -37,7 +37,7 @@ pub trait CompilerConfig { } /// Gets the custom compiler config - fn compiler(self: Box) -> Box; + fn compiler(self: Box) -> Box; /// Gets the default features for this compiler in the given target fn default_features_for_target(&self, _target: &Target) -> Features { @@ -49,9 +49,9 @@ pub trait CompilerConfig { } -impl From for Box +impl From for Box where - T: CompilerConfig + Send + Sync + 'static, + T: CompilerConfig + 'static, { fn from(other: T) -> Self { Box::new(other) @@ -59,7 +59,7 @@ where } /// An implementation of a Compiler from parsed WebAssembly module to Compiled native code. -pub trait Compiler { +pub trait Compiler: Send { /// Validates a module. /// /// It returns the a succesful Result in case is valid, `CompileError` in case is not. diff --git a/lib/engine-jit/src/builder.rs b/lib/engine-jit/src/builder.rs index b9c45ccf1..254f9d8bf 100644 --- a/lib/engine-jit/src/builder.rs +++ b/lib/engine-jit/src/builder.rs @@ -4,7 +4,7 @@ use wasmer_compiler::{CompilerConfig, Features, Target}; /// The JIT builder pub struct JIT { #[allow(dead_code)] - compiler_config: Option>, + compiler_config: Option>, target: Option, features: Option, } @@ -13,7 +13,7 @@ impl JIT { /// Create a new JIT pub fn new(compiler_config: T) -> Self where - T: Into>, + T: Into>, { Self { compiler_config: Some(compiler_config.into()), diff --git a/lib/engine-jit/src/engine.rs b/lib/engine-jit/src/engine.rs index 64c5f4f27..c3ff020ff 100644 --- a/lib/engine-jit/src/engine.rs +++ b/lib/engine-jit/src/engine.rs @@ -28,7 +28,7 @@ pub struct JITEngine { impl JITEngine { /// Create a new `JITEngine` with the given config #[cfg(feature = "compiler")] - pub fn new(compiler: Box, target: Target, features: Features) -> Self { + pub fn new(compiler: Box, target: Target, features: Features) -> Self { Self { inner: Arc::new(Mutex::new(JITEngineInner { compiler: Some(compiler), @@ -141,7 +141,7 @@ impl Engine for JITEngine { pub struct JITEngineInner { /// The compiler #[cfg(feature = "compiler")] - compiler: Option>, + compiler: Option>, /// The features to compile the Wasm module with features: Features, /// The code memory is responsible of publishing the compiled diff --git a/lib/engine-native/src/builder.rs b/lib/engine-native/src/builder.rs index 152b7c968..889fc26a9 100644 --- a/lib/engine-native/src/builder.rs +++ b/lib/engine-native/src/builder.rs @@ -13,7 +13,7 @@ impl Native { /// Create a new Native pub fn new(compiler_config: T) -> Self where - T: Into>, + T: Into>, { let mut compiler_config = compiler_config.into(); compiler_config.enable_pic(); @@ -91,7 +91,7 @@ mod tests { self.enabled_pic = true; } - fn compiler(&self) -> Box { + fn compiler(&self) -> Box { unimplemented!("compiler not implemented"); } diff --git a/lib/engine-native/src/engine.rs b/lib/engine-native/src/engine.rs index 220609c02..a922153a0 100644 --- a/lib/engine-native/src/engine.rs +++ b/lib/engine-native/src/engine.rs @@ -28,7 +28,7 @@ pub struct NativeEngine { impl NativeEngine { /// Create a new `NativeEngine` with the given config #[cfg(feature = "compiler")] - pub fn new(compiler: Box, target: Target, features: Features) -> Self { + pub fn new(compiler: Box, target: Target, features: Features) -> Self { let host_target = Triple::host(); let is_cross_compiling = target.triple() != &host_target; @@ -213,7 +213,7 @@ impl Into<&'static str> for Linker { pub struct NativeEngineInner { /// The compiler #[cfg(feature = "compiler")] - compiler: Option>, + compiler: Option>, /// The WebAssembly features to use #[cfg(feature = "compiler")] features: Features, diff --git a/lib/engine-object-file/src/builder.rs b/lib/engine-object-file/src/builder.rs index 3c3520188..41fa5e919 100644 --- a/lib/engine-object-file/src/builder.rs +++ b/lib/engine-object-file/src/builder.rs @@ -13,7 +13,7 @@ impl ObjectFile { /// Create a new ObjectFile pub fn new(compiler_config: T) -> Self where - T: Into>, + T: Into>, { let mut compiler_config = compiler_config.into(); compiler_config.enable_pic(); @@ -91,7 +91,7 @@ mod tests { self.enabled_pic = true; } - fn compiler(&self) -> Box { + fn compiler(&self) -> Box { unimplemented!("compiler not implemented"); } diff --git a/lib/engine-object-file/src/engine.rs b/lib/engine-object-file/src/engine.rs index a24fe358b..3f00db119 100644 --- a/lib/engine-object-file/src/engine.rs +++ b/lib/engine-object-file/src/engine.rs @@ -23,7 +23,7 @@ pub struct ObjectFileEngine { impl ObjectFileEngine { /// Create a new `ObjectFileEngine` with the given config #[cfg(feature = "compiler")] - pub fn new(compiler: Box, target: Target, features: Features) -> Self { + pub fn new(compiler: Box, target: Target, features: Features) -> Self { Self { inner: Arc::new(Mutex::new(ObjectFileEngineInner { compiler: Some(compiler), @@ -168,7 +168,7 @@ impl Engine for ObjectFileEngine { pub struct ObjectFileEngineInner { /// The compiler #[cfg(feature = "compiler")] - compiler: Option>, + compiler: Option>, /// The WebAssembly features to use #[cfg(feature = "compiler")] features: Features,