Fix a couple of bugs in the guest component bindgen - #1732
Merged
Conversation
syntactically
requested review from
andreiltd,
danbugs,
dblnz,
devigned,
jprendes,
jsturtevant,
ludfjig,
simongdavies and
squillace
as code owners
August 12, 2026 19:49
syntactically
force-pushed
the
lm/component-guest-fixes
branch
from
August 13, 2026 08:58
d8f899f to
bd7f3bc
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the Rust guest-side component binding generator to correct trait context handling during export emission and refine how imported resource types are recognized/emitted.
Changes:
- Adjusts guest bindgen logic for imported
Typeexterns to key offSubResourceand deriveHostResource*identifiers from the bound-var index. - Ensures
cur_traitis set to the export trait before emitting/registering top-level exports. - Cleans up imports in
guest.rs(dropsResolvedBoundVar).
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Previously, the guest bindgen would emit an impl for a resource trait whenever it encountered an exported type _that resolved to_e a resource type. Unfortunately, this was incorrect: a tyvar that is bounded to be equal to a resource type should not generate a new impl of its own, since there is no trait for it. Signed-off-by: Lucy Menon <168595099+syntactically@users.noreply.github.com>
Previously, functions directly exported by a component, without an intervening instance, would not have had their bindings generated correctly: the bindings would have referred to a non-existent imported version of the function, since `State::cur_trait` was not set properly. Signed-off-by: Lucy Menon <168595099+syntactically@users.noreply.github.com>
syntactically
force-pushed
the
lm/component-guest-fixes
branch
from
August 13, 2026 10:47
bd7f3bc to
2e72ca6
Compare
ludfjig
approved these changes
Aug 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.