diff --git a/crates/test-programs/tests/wasm_tests/runtime.rs b/crates/test-programs/tests/wasm_tests/runtime.rs index 8b27ecd2ae..1c0018b16c 100644 --- a/crates/test-programs/tests/wasm_tests/runtime.rs +++ b/crates/test-programs/tests/wasm_tests/runtime.rs @@ -53,7 +53,6 @@ pub fn instantiate(data: &[u8], bin_name: &str, workspace: Option<&Path>) -> any Instance::from_handle( &store, wasmtime_wasi::instantiate_wasi_with_context( - "", global_exports.clone(), builder.build().context("failed to build wasi context")?, ) diff --git a/crates/wasi/src/instantiate.rs b/crates/wasi/src/instantiate.rs index e66ce88c52..8c92b01f64 100644 --- a/crates/wasi/src/instantiate.rs +++ b/crates/wasi/src/instantiate.rs @@ -21,14 +21,13 @@ pub fn create_wasi_instance( environ: &[(String, String)], ) -> Result { let global_exports = store.borrow().global_exports().clone(); - let wasi = instantiate_wasi("", global_exports, preopened_dirs, argv, environ)?; + let wasi = instantiate_wasi(global_exports, preopened_dirs, argv, environ)?; let instance = api::Instance::from_handle(&store, wasi); Ok(instance) } /// Return an instance implementing the "wasi" interface. pub fn instantiate_wasi( - prefix: &str, global_exports: Rc>>>, preopened_dirs: &[(String, File)], argv: &[String], @@ -54,14 +53,13 @@ pub fn instantiate_wasi( let wasi_ctx = wasi_ctx_builder.build().map_err(|err| { InstantiationError::Resource(format!("couldn't assemble WASI context object: {}", err)) })?; - instantiate_wasi_with_context(prefix, global_exports, wasi_ctx) + instantiate_wasi_with_context(global_exports, wasi_ctx) } /// Return an instance implementing the "wasi" interface. /// /// The wasi context is configured by pub fn instantiate_wasi_with_context( - prefix: &str, global_exports: Rc>>>, wasi_ctx: WasiCtx, ) -> Result { @@ -88,10 +86,9 @@ pub fn instantiate_wasi_with_context( pointer_type, )); let func = module.functions.push(sig); - module.exports.insert( - prefix.to_owned() + stringify!($name), - Export::Function(func), - ); + module + .exports + .insert(stringify!($name).to_owned(), Export::Function(func)); finished_functions.push(syscalls::$name::SHIM as *const VMFunctionBody); }}; } diff --git a/src/bin/wasmtime.rs b/src/bin/wasmtime.rs index b935fbe4fa..fb0836541e 100644 --- a/src/bin/wasmtime.rs +++ b/src/bin/wasmtime.rs @@ -289,7 +289,7 @@ fn main() -> Result<()> { #[cfg(feature = "wasi-c")] { let global_exports = store.borrow().global_exports().clone(); - let handle = instantiate_wasi_c("", global_exports, &preopen_dirs, &argv, &environ)?; + let handle = instantiate_wasi_c(global_exports, &preopen_dirs, &argv, &environ)?; Instance::from_handle(&store, handle) } #[cfg(not(feature = "wasi-c"))]