Stream: git-wasmtime

Topic: wasmtime / issue #13304 Runtime abort returning `ThrownEx...


view this post on Zulip Wasmtime GitHub notifications bot (May 06 2026 at 19:02):

alexcrichton opened issue #13304:

This input:

use wasmtime::*;

fn main() -> wasmtime::Result<()> {
    let mut config = Config::new();
    config.wasm_exceptions(true);
    let engine = Engine::new(&config)?;
    let mut store = Store::new(&engine, ());

    let host_fn = Func::wrap(&mut store, || -> Result<()> { Err(ThrownException.into()) });

    let wat = r#"
        (module
          (import "" "host" (func $host))
          (func (export "go") call $host)
        )
    "#;
    let module = Module::new(&engine, wat::parse_str(wat)?)?;

    let instance = Instance::new(&mut store, &module, &[host_fn.into()])?;
    let go = instance.get_typed_func::<(), ()>(&mut store, "go")?;

    let result = go.call(&mut store, ());
    println!("result = {result:?}");
    Ok(())
}

yields:

$ cargo run -q
thread 'main' (2337993) panicked at /home/alex/code/wasmtime2/crates/wasmtime/src/runtime/vm/throw.rs:23:10:
Only invoked when an exception is pending
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

thread 'main' (2337993) panicked at /rustc/59807616e1fa2540724bfbac14d7976d7e4a3860/library/core/src/panicking.rs:225:5:
panic in a function that cannot unwind
stack backtrace:
 ... (big long backtrace)

view this post on Zulip Wasmtime GitHub notifications bot (May 06 2026 at 19:02):

alexcrichton added the wasm-proposal:exceptions label to Issue #13304.

view this post on Zulip Wasmtime GitHub notifications bot (May 06 2026 at 21:27):

alexcrichton assigned alexcrichton to issue #13304.

view this post on Zulip Wasmtime GitHub notifications bot (May 06 2026 at 22:04):

alexcrichton closed issue #13304:

This input:

use wasmtime::*;

fn main() -> wasmtime::Result<()> {
    let mut config = Config::new();
    config.wasm_exceptions(true);
    let engine = Engine::new(&config)?;
    let mut store = Store::new(&engine, ());

    let host_fn = Func::wrap(&mut store, || -> Result<()> { Err(ThrownException.into()) });

    let wat = r#"
        (module
          (import "" "host" (func $host))
          (func (export "go") call $host)
        )
    "#;
    let module = Module::new(&engine, wat::parse_str(wat)?)?;

    let instance = Instance::new(&mut store, &module, &[host_fn.into()])?;
    let go = instance.get_typed_func::<(), ()>(&mut store, "go")?;

    let result = go.call(&mut store, ());
    println!("result = {result:?}");
    Ok(())
}

yields:

$ cargo run -q
thread 'main' (2337993) panicked at /home/alex/code/wasmtime2/crates/wasmtime/src/runtime/vm/throw.rs:23:10:
Only invoked when an exception is pending
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

thread 'main' (2337993) panicked at /rustc/59807616e1fa2540724bfbac14d7976d7e4a3860/library/core/src/panicking.rs:225:5:
panic in a function that cannot unwind
stack backtrace:
 ... (big long backtrace)


Last updated: Jun 01 2026 at 09:49 UTC