Stream: git-wasmtime

Topic: wasmtime / PR #14434 component: document ownership of exp...


view this post on Zulip Wasmtime GitHub notifications bot (Sep 27 2026 at 03:19):

Byte-Naut opened PR #14434 from Byte-Naut:issue-9946 to bytecodealliance:main:

Closes #9946.

Motivation

@tliron pointed out in #9946 that the exported resources example only gets a ResourceAny from a constructor, so it doesn't show what to do with a guest resource returned by an ordinary function, how to hand it back to the guest, or whether the host has to call resource_drop on it. The ResourceAny docs also didn't say that try_into_resource only works for host-defined resources. The ownership rules were explained in the thread, but they aren't written down in the docs or shown in the example yet. This follows @tliron's suggestion to show a resource both passed to and returned from exported functions.

Changes

Documentation only: no runtime or public API changes. The Guest bindings in the example module gain three methods from the new WIT.

Testing

cargo test -p wasmtime --doc _6_exported_resources   # with RUSTDOCFLAGS="--cfg docsrs"

Locally: fmt, and cargo doc -p wasmtime both with and without --cfg docsrs, with no new rustdoc warnings. I also ran the existing pass_guest_back_as_borrow, manually_destroy, and resource_drop_concurrent_in_run_concurrent tests, which cover the behavior the new docs describe.

resource_drop_concurrent, which came out of @SilverMira's comment here via #14291, was added in #14362, so the drop docs there already list all three variants.

Developed with assistance from Claude (Anthropic). Per the Bytecode Alliance AI Tool Use Policy, I'm the author and accountable for this change.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 27 2026 at 03:19):

Byte-Naut requested fitzgen for a review on PR #14434.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 27 2026 at 03:19):

Byte-Naut requested wasmtime-core-reviewers for a review on PR #14434.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 27 2026 at 04:49):

github-actions[bot] added the label wasmtime:api on PR #14434.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 29 2026 at 21:22):

alexcrichton unassigned fitzgen from PR #14434 component: document ownership of exported guest resources.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 29 2026 at 21:22):

alexcrichton requested alexcrichton for a review on PR #14434.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 29 2026 at 21:25):

:thumbs_up: alexcrichton submitted PR review:

Thanks for the doc updates here it's much appreciated! In the abstract the bindgen_examples module is a bit lacking, so if you've got ideas of more examples to add there I think that'd be great!

view this post on Zulip Wasmtime GitHub notifications bot (Sep 29 2026 at 21:25):

alexcrichton added PR #14434 component: document ownership of exported guest resources to the merge queue.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 29 2026 at 21:52):

:check: alexcrichton merged PR #14434.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 29 2026 at 21:52):

alexcrichton removed PR #14434 component: document ownership of exported guest resources from the merge queue.


Last updated: Oct 11 2026 at 04:10 UTC