Stream: git-wasmtime

Topic: wasmtime / PR #14891 [DO NOT REVIEW] Avoid collisions bet...


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

jrandolf opened PR #14891 from jrandolf:bindgen-name-collisions-shared to bytecodealliance:main:

This builds on #14867, so only the last commit is new here. It fixes the rest of #14856: labels and other names in a world clashing with the names bindgen! generates.

In review of #14867 the suggestion was that bindgen! should generate bindings that can represent any valid WIT, rather than detecting clashes and erroring. This does that. All the names generated for a world's imports and exports are now chosen in one place, WorldNames, before any bindings are generated. That covers:

When two names would collide, the one claimed later gets a trailing _. The order is fixed and documented in a new "Generated names" section of the bindgen! docs: reserved names first (exports, named_imports, new, instantiate, ...), then namespaces and plain exports, then exported functions, then labels. Names that don't collide stay the same, so none of the existing expanded snapshots change.

Some examples, in package foo:foo:

WIT Generated
export foo: greeter; + export greeter; exports::foo_ with accessor foo(), next to exports::foo::foo::greeter
export foo-foo-greeter: greeter; + export greeter; accessors foo_foo_greeter_() and foo_foo_greeter()
export new: interface {} accessor new_()
export call-run: interface {} + export run: func(); call_run() for the function, call_run_() for the label
import foo: interface { ... } module foo_, next to the namespace foo
import exports: interface { ... } module exports__

While here, this also fixes keyword escaping for uppercase names like TYPE and for keyword namespaces and packages (package %use:%fn), which produced invalid identifiers in the same places.

The new name-collisions.wit codegen test covers these. Without this change, the macro panics on it or the output fails to compile.

Closes #14856

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

jrandolf updated PR #14891.

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

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

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

jrandolf updated PR #14891.

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

jrandolf edited PR #14891:

This fixes the rest of #14856: labels and other names in a world clashing with the names bindgen! generates.

In review of #14867 the suggestion was that bindgen! should generate bindings that can represent any valid WIT, rather than detecting clashes and erroring. This does that. All the names generated for a world's imports and exports are now chosen in one place, WorldNames, before any bindings are generated. That covers:

When two names would collide, the one claimed later gets a trailing _. The order is fixed and documented in a new "Generated names" section of the bindgen! docs: reserved names first (exports, named_imports, new, instantiate, ...), then namespaces and plain exports, then exported functions, then labels. Names that don't collide stay the same, so none of the existing expanded snapshots change.

Some examples, in package foo:foo:

WIT Generated
export foo: greeter; + export greeter; exports::foo_ with accessor foo(), next to exports::foo::foo::greeter
export foo-foo-greeter: greeter; + export greeter; accessors foo_foo_greeter_() and foo_foo_greeter()
export new: interface {} accessor new_()
export call-run: interface {} + export run: func(); call_run() for the function, call_run_() for the label
import foo: interface { ... } module foo_, next to the namespace foo
import exports: interface { ... } module exports__

While here, this also fixes keyword escaping for uppercase names like TYPE and for keyword namespaces and packages (package %use:%fn), which produced invalid identifiers in the same places.

The new name-collisions.wit codegen test covers these. Without this change, the macro panics on it or the output fails to compile.

Closes #14856

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

jrandolf has marked PR #14891 as ready for review.

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

jrandolf removed the review request for wasmtime-core-reviewers from PR #14891.

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

jrandolf requested wasmtime-core-reviewers for a review on PR #14891.

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

jrandolf requested pchickey for a review on PR #14891.


Last updated: Oct 31 2026 at 23:03 UTC