Skip to content

Generate nominal IDs for all bindings generation #1526

Merged
alexcrichton merged 3 commits intobytecodealliance:mainfrom
alexcrichton:nominal
Feb 10, 2026
Merged

Generate nominal IDs for all bindings generation #1526
alexcrichton merged 3 commits intobytecodealliance:mainfrom
alexcrichton:nominal

Conversation

@alexcrichton
Copy link
Member

This commit leverages bytecodealliance/wasm-tools#2447 to make many
existing and future problems much easier in wit-bindgen. Namely a
TypeId now uniquely identifies a type to be generated rather than
simultaneously representing both an import and an export in some
situations. This isn't immediately leveraged in bindings generators just
yet but it's intended to open up the doors to benefitting from this in
the future.

This commit leverages bytecodealliance/wasm-tools#2447 to make many
existing and future problems much easier in `wit-bindgen`. Namely a
`TypeId` now uniquely identifies a type to be generated rather than
simultaneously representing both an import and an export in some
situations. This isn't immediately leveraged in bindings generators just
yet but it's intended to open up the doors to benefitting from this in
the future.
No major changes just yet, but this shows some examples of removing
non-obvious logic in bindings generation enabled by nominal type ids.
@alexcrichton alexcrichton added this pull request to the merge queue Feb 10, 2026
interfaces.insert(name, key.clone());
interfaces
.entry(name)
.or_insert(Vec::new())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.or_insert(Vec::new())
.or_insert_with(Vec::new)

Merged via the queue into bytecodealliance:main with commit 7bebfd6 Feb 10, 2026
26 of 27 checks passed
@alexcrichton alexcrichton deleted the nominal branch February 10, 2026 21:49
alexcrichton added a commit to alexcrichton/wit-bindgen that referenced this pull request Feb 11, 2026
github-merge-queue bot pushed a commit that referenced this pull request Feb 11, 2026
Follow-up from #1468 to account for work in #1526.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Comments