fitzgen opened PR #10374 from fitzgen:anyref-from-raw-clone-gc-ref to bytecodealliance:main:
Like
ExternRef::from_rawdoes.This is because while
to_rawclones the GC ref, it also exposes it to Wasm, inserting it into the DRC collector's table, which effectively gives ownership of that clone to Wasm. Then, if we don't clone infrom_raw, when a GC is triggered, the DRC collector will see that Wasm isn't holding the ref alive anymore and will decref (and perhaps even deallocate) it, which leaves theAnyRefwe constructed viafrom_rawdangling.Fixes #10182
<!--
Please make sure you include the following information:
If this work has been discussed elsewhere, please include a link to that
conversation. If it was discussed in an issue, just mention "issue #...".Explain why this change is needed. If the details are in an issue already,
this can be brief.Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.htmlPlease ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->
fitzgen requested pchickey for a review on PR #10374.
fitzgen requested wasmtime-core-reviewers for a review on PR #10374.
github-actions[bot] commented on PR #10374:
Subscribe to Label Action
cc @fitzgen
<details>
This issue or pull request has been labeled: "wasmtime:api", "wasmtime:ref-types"Thus the following users have been cc'd because of the following labels:
- fitzgen: wasmtime:ref-types
To subscribe or unsubscribe from this label, edit the <code>.github/subscribe-to-label.json</code> configuration file.
Learn more.
</details>
alexcrichton submitted PR review.
alexcrichton merged PR #10374.
Last updated: Dec 13 2025 at 19:03 UTC