Repository navigation
Write component macro debug output without including it - #2122
Open
Anurag-S1ngh wants to merge 1 commit into
Open
Anurag-S1ngh wants to merge 1 commit into
Anurag-S1ngh wants to merge 1 commit into
Conversation
Anurag-S1ngh
requested review from
andreiltd,
danbugs,
dblnz,
devigned,
jprendes,
jsturtevant,
ludfjig,
simongdavies,
squillace and
syntactically
as code owners
November 29, 2026 07:59
The debug file set by HYPERLIGHT_COMPONENT_MACRO_DEBUG was read back with include!(), so when a crate invoked the bindgen macros more than once the included file could hold another invocation's expansion. Emit the generated tokens directly and keep writing the file for inspection. Signed-off-by: Anurag Singh <anuragsingh2313@gmail.com>
Anurag-S1ngh
force-pushed
the
fix/1107-component-macro-debug-race
branch
from
November 29, 2026 08:10
0c44248 to
52000ee
Compare
This branch has not been deployed
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.
Summary
HYPERLIGHT_COMPONENT_MACRO_DEBUGwrote the generated code to a file and then read it back withinclude!(). When a crate invoked the bindgen macros more than once, a later invocation could overwrite the file before the earlierinclude!()was expanded, so the compiled code did not match the macro input. The macro now emits the tokens it generated directly, while still writing the file for inspection.Changes
emit_declsreturns the token stream it was given instead of aninclude!of the debug file.write_debug_fileand added tests for the returned tokens and the#path substitution.Testing
cargo test -p hyperlight-component-util --libcargo clippy -p hyperlight-component-util -p hyperlight-component-macro --all-targetscargo fmt -p hyperlight-component-util -p hyperlight-component-macro -- --checkcargo test -p hyperlight-component-utilalso runs doctests, andsubstitute::Shiftablehas a pre-existing doctest failure that is unrelated to this change.Closes #1107