Stream: git-wasmtime

Topic: wasmtime / PR #14872 [DO NOT REVIEW] Fill gaps in the emb...


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

jrandolf edited PR #14872.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 20 2026 at 01:09):

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

view this post on Zulip Wasmtime GitHub notifications bot (Oct 20 2026 at 01:09):

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

view this post on Zulip Wasmtime GitHub notifications bot (Oct 20 2026 at 20:39):

jrandolf updated PR #14872.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 20 2026 at 22:19):

jrandolf updated PR #14872.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 21 2026 at 18:23):

jrandolf updated PR #14872.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 21 2026 at 18:50):

jrandolf edited PR #14872:

This fills the gaps from #14862 in how implements and external-id are exposed to embedders:

Closes #14862

<details>
<summary>LLM summary of the changes</summary>

1. Looking up an export together with its attributes

The problem: Component::get_export and Instance::get_export return a ComponentItem, which is only the type. The implements and external-id of an export were only reachable by walking component_type().exports(). Wasmtime already stored them next to each export name, in NameMap<_, (ExportIndex, ComponentExternData)>, but nothing read them.

The change:

2. Type imports at the root now show up in component_type().imports()

The problem: a root import like (import "t" (external-id "x") (type (eq $u))) was missing from the component's reported type, while root type exports and nested component types were listed. In inline.rs, type imports continue before reaching import_types, which is the list the Linker has to satisfy, and ComponentTypesBuilder::finish built the reported imports from that list.

The change:

3. ComponentExtern no longer borrows the Engine

The problem: ComponentExtern<'a> from types::Component and types::ComponentInstance was tied to the &'a Engine borrow, even though its strings only borrow from the type. So ty.get_import(&engine.clone(), "p") didn't compile.

The change:

Knock-on change in wit-bindgen/src/lib.rs: the add_to_linker that bindgen! generates for named_imports worked around the old borrow. It cloned the engine and collected matching imports first, then defined them in a second loop. It now does both in one loop: iterate component_ty.imports(linker.engine()), skip imports where is_implements is false, then call lookup(name)? and linker.instance(name)?.

Side effect: if lookup fails partway through, the imports that matched before it are already defined in the linker. Before, nothing was defined unless every lookup succeeded.

4. ComponentExtern is #[non_exhaustive]

This leaves room to add fields later, such as a version suffix for canonical names. It breaks code that builds the struct with a literal or destructures it exhaustively. Nothing in the repo does, and only Wasmtime produces it.

Tests

</details>


Last updated: Oct 31 2026 at 23:03 UTC