Docs: Report findings for issue #2177 and add regression tests #2787
+66
−0
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.
I have confirmed that the
private_boundslint failure reported in #2177 is likely a rustc bug related to hygiene in mixed macro contexts.Findings:
private_boundslint triggers when#[derive(KnownLayout)]is used inside amacro_rules!macro. This is reproduced inzerocopy-derive/tests/issue_2177.rs(which passes only because of the existing#[allow(private_bounds)]suppression).KnownLayoutinside amacro_rules!macro (without using the proc-macro) does not trigger the lint. This is demonstrated inzerocopy-derive/tests/issue_2177_control.rs. This isolates the issue to the interaction betweenproc_macrogenerated spans andmacro_rules!expansion, confirming it's not a logic error in the generated code itself.I have verified that the current
mainbranch (with the workaround) passes these tests. I am committing these tests to prevent regression and document the behavior.Command Log:
To reproduce the failure (temporarily revert
#[allow(private_bounds)]inzerocopy-derive/src/lib.rs):yes | ./cargo.sh +nightly test -p zerocopy-derive --test issue_2177To verify the control case passes (no changes needed):
yes | ./cargo.sh +nightly test -p zerocopy-derive --test issue_2177_controlPR created automatically by Jules for task 6073541928888338093 started by @joshlf