diff --git a/crates/wasmtime/src/config.rs b/crates/wasmtime/src/config.rs index 504d8d22b067..99b7ca860446 100644 --- a/crates/wasmtime/src/config.rs +++ b/crates/wasmtime/src/config.rs @@ -1520,7 +1520,7 @@ impl Config { } #[cfg(compiler)] - pub(crate) fn build_compiler(&mut self) -> Result> { + pub(crate) fn build_compiler(mut self) -> Result<(Self, Box)> { let mut compiler = match self.compiler_config.strategy { #[cfg(feature = "cranelift")] Strategy::Auto => wasmtime_cranelift::builder(), @@ -1614,7 +1614,7 @@ impl Config { compiler.enable_incremental_compilation(cache_store.clone())?; } - compiler.build() + Ok((self, compiler.build()?)) } /// Internal setting for whether adapter modules for components will have diff --git a/crates/wasmtime/src/engine.rs b/crates/wasmtime/src/engine.rs index 2db8602fc7d0..31eddbe5d269 100644 --- a/crates/wasmtime/src/engine.rs +++ b/crates/wasmtime/src/engine.rs @@ -81,12 +81,11 @@ impl Engine { debug_builtins::ensure_exported(); let registry = SignatureRegistry::new(); - let mut config = config.clone(); + let config = config.clone(); config.validate()?; #[cfg(compiler)] - let compiler = config.build_compiler()?; - drop(&mut config); // silence warnings without `cfg(compiler)` + let (config, compiler) = config.build_compiler()?; let allocator = config.build_allocator()?; let profiler = config.build_profiler()?;