Repository navigation
[hyperlight_component_util] Properly disambiguate chains of associated types - #1721
Merged
Merged
Conversation
syntactically
requested review from
andreiltd,
dblnz,
devigned,
jprendes,
jsturtevant,
ludfjig,
simongdavies and
squillace
as code owners
August 12, 2026 10:22
syntactically
force-pushed
the
lm/component-disambiguate-chains
branch
from
August 12, 2026 10:25
b80535f to
7977dbe
Compare
syntactically
force-pushed
the
lm/component-disambiguate-chains
branch
from
August 12, 2026 10:29
7977dbe to
b993b38
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Improves Rust component bindgen codegen so chains of associated types (for nested instance/resource references) are emitted with the necessary trait disambiguation syntax, avoiding invalid paths like Self::Foo::Bar::Baz::T in cases where Rust requires qualified syntax.
Changes:
- Reworked
emit_resource_refto walk the path step-by-step and introducetrait_reffor consistent trait-path emission with instantiated type variables. - Updated host/guest impl codegen state-path handling to carry trait bounds for nested associated-type projections, and generalized
self_param_varto aTokenStream. - Added a regression coverage module that exercises deeply nested instance/resource paths.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/hyperlight_host/tests/wit_test.rs | Adds a deeply-nested inline component to exercise the problematic associated-type path pattern in host bindgen. |
| src/hyperlight_component_util/src/rtypes.rs | Implements trait-disambiguated resource-type reference emission and adds trait_ref helper. |
| src/hyperlight_component_util/src/host.rs | Tracks nested state projections with explicit trait bounds to generate disambiguated associated-type paths in host impl codegen. |
| src/hyperlight_component_util/src/guest.rs | Aligns guest impl codegen self_param_var handling with the new TokenStream representation and export-trait qualification. |
| src/hyperlight_component_util/src/emit.rs | Updates State::self_param_var to Option<TokenStream> and documents origin/self-parameter expectations for higher-order components. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
jsturtevant
reviewed
Aug 12, 2026
jsturtevant
previously approved these changes
Aug 12, 2026
syntactically
force-pushed
the
lm/component-disambiguate-chains
branch
3 times, most recently
from
August 12, 2026 19:48
17cbd9e to
c3448c5
Compare
syntactically
changed the base branch from
lm/component-test-qol
to
lm/component-guest-fixes
August 12, 2026 19:54
syntactically
force-pushed
the
lm/component-disambiguate-chains
branch
from
August 13, 2026 08:58
c3448c5 to
0ec1b0f
Compare
…d types Previously, the Rust component bindgen would in certain circumstances produce long chains of associated type references, e.g. Self::Foo::Bar::Baz::T. Unfortunately, Rust will not actually accept these without disambiguating syntax indicating from which trait the extern types should be drawn. This commit modifies the relevant logic in `emit_resource_ref` to walk through the path properly, and then deals with the consequences of that everywhere else. Signed-off-by: Lucy Menon <168595099+syntactically@users.noreply.github.com>
syntactically
force-pushed
the
lm/component-disambiguate-chains
branch
from
August 13, 2026 10:47
0ec1b0f to
6cb3adf
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.
Previously, the Rust component bindgen would in certain circumstances produce long chains of associated type references, e.g. Self::Foo::Bar::Baz::T. Unfortunately, Rust will not actually accept these without disambiguating syntax indicating from which trait the extern types should be drawn. This commit modifies the relevant logic in
emit_resource_refto walk through the path properly, and then deals with the consequences of that everywhere else.