mirror of
https://github.com/mii443/wasmer.git
synced 2025-12-10 14:48:27 +00:00
Fix feature flags and misleading error message
This commit is contained in:
@@ -66,6 +66,13 @@ impl Store {
|
||||
}
|
||||
}
|
||||
|
||||
/// Creates a new headless `Store` without any compilers enabled that can
|
||||
/// be used to execute `Module`s, but not compile them.
|
||||
#[cfg(feature = "compiler")]
|
||||
pub fn headless() -> Self {
|
||||
Self::new(EngineBuilder::headless().engine())
|
||||
}
|
||||
|
||||
#[cfg(feature = "compiler")]
|
||||
#[deprecated(
|
||||
since = "3.0.0",
|
||||
@@ -173,21 +180,13 @@ impl Default for Store {
|
||||
#[allow(unreachable_code, unused_mut)]
|
||||
fn get_engine() -> Engine {
|
||||
cfg_if::cfg_if! {
|
||||
if #[cfg(feature = "compiler")] {
|
||||
|
||||
cfg_if::cfg_if! {
|
||||
if #[cfg(any(feature = "cranelift", feature = "llvm", feature = "singlepass"))]
|
||||
{
|
||||
let config = get_config();
|
||||
EngineBuilder::new(Box::new(config) as Box<dyn wasmer_compiler::CompilerConfig>)
|
||||
.engine()
|
||||
} else {
|
||||
EngineBuilder::headless()
|
||||
.engine()
|
||||
}
|
||||
}
|
||||
if #[cfg(any(feature = "cranelift", feature = "llvm", feature = "singlepass"))]
|
||||
{
|
||||
let config = get_config();
|
||||
EngineBuilder::new(Box::new(config) as Box<dyn wasmer_compiler::CompilerConfig>)
|
||||
.engine()
|
||||
} else {
|
||||
compile_error!("No default engine chosen")
|
||||
compile_error!("No compiler [cranelift, llvm, singlepass] enabled, use Store::headless() instead of Store::default() for a headless engine")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user