fix more cases of passing imports by reference to instantiate

This commit is contained in:
Mackenzie Clark 2019-02-04 15:00:57 -08:00
parent d82155f558
commit c771f2e677
3 changed files with 5 additions and 5 deletions

View File

@ -45,14 +45,14 @@ fn main() -> Result<()> {
},
};
let inner_instance = inner_module.instantiate(import_object)?;
let inner_instance = inner_module.instantiate(&import_object)?;
let outer_imports = imports! {
"env" => inner_instance,
};
let outer_module = wasmer_runtime_core::compile_with(EXAMPLE_WASM, &CraneliftCompiler::new())?;
let outer_instance = outer_module.instantiate(outer_imports)?;
let outer_instance = outer_module.instantiate(&outer_imports)?;
let ret = outer_instance.call("main", &[Value::I32(42)])?;
println!("ret: {:?}", ret);

View File

@ -27,7 +27,7 @@ fn create_module_1() -> Instance {
let module = wasmer_runtime_core::compile_with(&wasm_binary[..], &CraneliftCompiler::new())
.expect("WASM can't be compiled");
module
.instantiate(generate_imports())
.instantiate(&generate_imports())
.expect("WASM can't be instantiated")
}
@ -47,7 +47,7 @@ pub fn generate_imports() -> ImportObject {
let module = wasmer_runtime_core::compile_with(&wasm_binary[..], &CraneliftCompiler::new())
.expect("WASM can't be compiled");
let instance = module
.instantiate(ImportObject::new())
.instantiate(&ImportObject::new())
.expect("WASM can't be instantiated");
let mut imports = ImportObject::new();
imports.register("spectest", instance);

View File

@ -25,7 +25,7 @@ mod tests {
let module = wasmer_runtime_core::compile_with(&wasm_binary[..], &CraneliftCompiler::new())
.expect("WASM can't be compiled");
let instance = module
.instantiate(ImportObject::new())
.instantiate(&ImportObject::new())
.expect("WASM can't be instantiated");
let result = instance.call("stack-overflow", &[]);