Skip to content

Plumb external-id on component import/export#13874

Merged
alexcrichton merged 1 commit into
bytecodealliance:mainfrom
ricochet:worktree-external-id
Jul 14, 2026
Merged

Plumb external-id on component import/export#13874
alexcrichton merged 1 commit into
bytecodealliance:mainfrom
ricochet:worktree-external-id

Conversation

@ricochet

Copy link
Copy Markdown
Contributor

This plumbs (external-id "...") annotation added in wasm-tools through Wasmtime's type reflection, mirroring implements. The annotation is a free-form host-defined identifier which is ignored by type checking and is intended to tell the host how to satisfy an import (or interpret an export), e.g. distinguishing two imports of the same interface by a platform-native resource id.

The field is added to ComponentExternData in wasmtime-environ and populated from wasmparser in both the type-conversion and nested instance exports, including func- and type-level annotations.

wasmparser validates (external-id) behind the same cm-implements gate as (implements), so Config::wasm_component_model_implements(true) enables both.

Note that adding a public field to ComponentExtern is a breaking change for any embedder constructing or exhaustively destructuring it.

@ricochet
ricochet requested a review from a team as a code owner July 13, 2026 23:20
@ricochet
ricochet requested review from dicej and removed request for a team July 13, 2026 23:20
Comment thread crates/environ/src/component/types.rs Outdated
This plumbs the `(external-id "...")` annotation added in wasm-tools
0.253.0 through Wasmtime's type reflection, mirroring implements.
The annotation is a free-form host-defined identifier which
is ignored by type checking and is intended to tell the host how to
satisfy an import (or interpret an export), e.g. distinguishing two
imports of the same interface by a platform-native resource id.

The field is added to `ComponentExternData` in wasmtime-environ and
populated from wasmparser in both the type-conversion and nested
instance exports, including func- and type-level annotations.

New public API `ComponentExtern::external_id` field alongside `implements`.

wasmparser validates `(external-id)` behind the same `cm-implements` gate as `(implements)`, so `Config::wasm_component_model_implements(true)` enables both.

Note that adding a public field to `ComponentExtern` is a breaking
change for any embedder constructing or exhaustively destructuring it.

Signed-off-by: Bailey Hayes <bailey@cosmonic.com>
@ricochet
ricochet force-pushed the worktree-external-id branch from b3e51e4 to d6bea9c Compare July 14, 2026 00:22
@github-actions github-actions Bot added the wasmtime:api Related to the API of the `wasmtime` crate itself label Jul 14, 2026
@alexcrichton
alexcrichton added this pull request to the merge queue Jul 14, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jul 14, 2026
@alexcrichton
alexcrichton added this pull request to the merge queue Jul 14, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jul 14, 2026
@alexcrichton
alexcrichton added this pull request to the merge queue Jul 14, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jul 14, 2026
@alexcrichton
alexcrichton added this pull request to the merge queue Jul 14, 2026
Merged via the queue into bytecodealliance:main with commit 752d85a Jul 14, 2026
53 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

wasmtime:api Related to the API of the `wasmtime` crate itself

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants