Fix lint errors when singlepass is disabled.

This commit is contained in:
losfair 2019-11-20 01:52:33 +08:00
parent c9aa37fc99
commit 93f096b726

View File

@ -860,27 +860,27 @@ fn validate(validate: Validate) {
} }
} }
fn get_compiler_by_backend(backend: Backend, opts: &Run) -> Option<Box<dyn Compiler>> { fn get_compiler_by_backend(backend: Backend, _opts: &Run) -> Option<Box<dyn Compiler>> {
use wasmer_runtime_core::codegen::MiddlewareChain;
let opts = opts.clone();
let middlewares_gen = move || {
let mut middlewares = MiddlewareChain::new();
if opts.call_trace {
use wasmer_middleware_common::call_trace::CallTrace;
middlewares.push(CallTrace::new());
}
if opts.block_trace {
use wasmer_middleware_common::block_trace::BlockTrace;
middlewares.push(BlockTrace::new());
}
middlewares
};
Some(match backend { Some(match backend {
#[cfg(feature = "backend-singlepass")] #[cfg(feature = "backend-singlepass")]
Backend::Singlepass => { Backend::Singlepass => {
use wasmer_runtime_core::codegen::StreamingCompiler; use wasmer_runtime_core::codegen::StreamingCompiler;
use wasmer_singlepass_backend::ModuleCodeGenerator as SinglePassMCG; use wasmer_singlepass_backend::ModuleCodeGenerator as SinglePassMCG;
use wasmer_runtime_core::codegen::MiddlewareChain;
let opts = _opts.clone();
let middlewares_gen = move || {
let mut middlewares = MiddlewareChain::new();
if opts.call_trace {
use wasmer_middleware_common::call_trace::CallTrace;
middlewares.push(CallTrace::new());
}
if opts.block_trace {
use wasmer_middleware_common::block_trace::BlockTrace;
middlewares.push(BlockTrace::new());
}
middlewares
};
let c: StreamingCompiler<SinglePassMCG, _, _, _, _> = let c: StreamingCompiler<SinglePassMCG, _, _, _, _> =
StreamingCompiler::new(middlewares_gen); StreamingCompiler::new(middlewares_gen);