Stream: git-wasmtime

Topic: wasmtime / issue #13037 Passing GC objects multiple times...


view this post on Zulip Wasmtime GitHub notifications bot (Apr 10 2026 at 15:47):

alexcrichton opened issue #13037:

This test:

    use std::sync::Arc;
    use std::sync::atomic::{AtomicBool, Ordering};
    use wasmtime::*;

    #[derive(Clone)]
    struct SetOnDrop(Arc<AtomicBool>);

    impl Drop for SetOnDrop {
        fn drop(&mut self) {
            self.0.store(true, Ordering::SeqCst);
        }
    }

    #[test]
    fn doit() -> Result<()> {
        let engine = Engine::default();
        let mut store = Store::new(&engine, ());

        let module = Module::new(
            &engine,
            r#"(module (func (export "nop") (param externref)))"#,
        )?;

        let instance = Instance::new(&mut store, &module, &[])?;
        let nop = instance.get_typed_func::<Option<Rooted<ExternRef>>, ()>(&mut store, "nop")?;

        let dropped = Arc::new(AtomicBool::new(false));
        {
            let mut scope = RootScope::new(&mut store);
            let ext = ExternRef::new(&mut scope, SetOnDrop(dropped.clone()))?;

            nop.call(&mut scope, Some(ext))?;
            nop.call(&mut scope, Some(ext))?;
        }

        store.gc(None)?;

        assert!(dropped.load(Ordering::SeqCst));

        Ok(())
    }

currently fails:

$ cargo test -q

running 1 test
tests::doit --- FAILED

failures:

---- tests::doit stdout ----

thread 'tests::doit' (743272) panicked at src/lib.rs:65:9:
assertion failed: dropped.load(Ordering::SeqCst)
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace


failures:
    tests::doit

test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s

error: test failed, to rerun pass `--lib`

view this post on Zulip Wasmtime GitHub notifications bot (Apr 10 2026 at 15:47):

alexcrichton added the wasm-proposal:gc label to Issue #13037.


Last updated: Apr 12 2026 at 23:10 UTC