mirror of
https://github.com/mii443/wasmer.git
synced 2025-12-09 22:28:21 +00:00
Fixed compilation issue
This commit is contained in:
@@ -136,7 +136,7 @@ cfg_if! {
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wasm_engine_new() -> Box<wasm_engine_t> {
|
||||
let compiler_config: Box<dyn CompilerConfig> = get_default_compiler_config();
|
||||
let engine: Arc<dyn Engine + Send + Sync> = Arc::new(JIT::new(*compiler_config).engine());
|
||||
let engine: Arc<dyn Engine + Send + Sync> = Arc::new(JIT::new(compiler_config).engine());
|
||||
Box::new(wasm_engine_t { inner: engine })
|
||||
}
|
||||
}
|
||||
@@ -154,7 +154,7 @@ cfg_if! {
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wasm_engine_new() -> Box<wasm_engine_t> {
|
||||
let mut compiler_config: Box<dyn CompilerConfig> = get_default_compiler_config();
|
||||
let engine: Arc<dyn Engine + Send + Sync> = Arc::new(Native::new( *compiler_config).engine());
|
||||
let engine: Arc<dyn Engine + Send + Sync> = Arc::new(Native::new(compiler_config).engine());
|
||||
Box::new(wasm_engine_t { inner: engine })
|
||||
}
|
||||
}
|
||||
@@ -243,7 +243,7 @@ pub extern "C" fn wasm_engine_new_with_config(
|
||||
wasmer_engine_t::JIT => {
|
||||
cfg_if! {
|
||||
if #[cfg(feature = "jit")] {
|
||||
Arc::new(JIT::new(*compiler_config).engine())
|
||||
Arc::new(JIT::new(compiler_config).engine())
|
||||
} else {
|
||||
return return_with_error("Wasmer has not been compiled with the `jit` feature.");
|
||||
}
|
||||
@@ -252,7 +252,7 @@ pub extern "C" fn wasm_engine_new_with_config(
|
||||
wasmer_engine_t::NATIVE => {
|
||||
cfg_if! {
|
||||
if #[cfg(feature = "native")] {
|
||||
Arc::new(Native::new( *compiler_config).engine())
|
||||
Arc::new(Native::new(compiler_config).engine())
|
||||
} else {
|
||||
return return_with_error("Wasmer has not been compiled with the `native` feature.");
|
||||
}
|
||||
|
||||
@@ -11,9 +11,9 @@ pub struct JIT {
|
||||
|
||||
impl JIT {
|
||||
/// Create a new JIT
|
||||
pub fn new(compiler_config: impl CompilerConfig + 'static) -> Self {
|
||||
pub fn new<T>(compiler_config: T) -> Self where T: Into<Box<dyn CompilerConfig>> {
|
||||
Self {
|
||||
compiler_config: Some(Box::new(compiler_config)),
|
||||
compiler_config: Some(compiler_config.into()),
|
||||
target: None,
|
||||
features: None,
|
||||
}
|
||||
|
||||
@@ -11,11 +11,12 @@ pub struct Native {
|
||||
impl Native {
|
||||
#[cfg(feature = "compiler")]
|
||||
/// Create a new Native
|
||||
pub fn new(mut compiler_config: impl CompilerConfig + 'static) -> Self {
|
||||
pub fn new<T>(compiler_config: T) -> Self where T: Into<Box<dyn CompilerConfig>> {
|
||||
let mut compiler_config = compiler_config.into();
|
||||
compiler_config.enable_pic();
|
||||
|
||||
Self {
|
||||
compiler_config: Some(Box::new(compiler_config)),
|
||||
compiler_config: Some(compiler_config),
|
||||
target: None,
|
||||
features: None,
|
||||
}
|
||||
|
||||
@@ -11,11 +11,12 @@ pub struct ObjectFile {
|
||||
impl ObjectFile {
|
||||
#[cfg(feature = "compiler")]
|
||||
/// Create a new ObjectFile
|
||||
pub fn new(mut compiler_config: impl CompilerConfig + 'static) -> Self {
|
||||
pub fn new<T>(compiler_config: T) -> Self where T: Into<Box<dyn CompilerConfig>> {
|
||||
let mut compiler_config = compiler_config.into();
|
||||
compiler_config.enable_pic();
|
||||
|
||||
Self {
|
||||
compiler_config: Some(Box::new(compiler_config)),
|
||||
compiler_config: Some(compiler_config),
|
||||
target: None,
|
||||
features: None,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user