Skip to content

Conversation

@google-labs-jules
Copy link
Contributor

I have confirmed that the private_bounds lint failure reported in #2177 is likely a rustc bug related to hygiene in mixed macro contexts.

Findings:

  1. Reproduction: The private_bounds lint triggers when #[derive(KnownLayout)] is used inside a macro_rules! macro. This is reproduced in zerocopy-derive/tests/issue_2177.rs (which passes only because of the existing #[allow(private_bounds)] suppression).
  2. Control Case: Manually expanding the code generated by KnownLayout inside a macro_rules! macro (without using the proc-macro) does not trigger the lint. This is demonstrated in zerocopy-derive/tests/issue_2177_control.rs. This isolates the issue to the interaction between proc_macro generated spans and macro_rules! expansion, confirming it's not a logic error in the generated code itself.

I have verified that the current main branch (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)] in zerocopy-derive/src/lib.rs):
yes | ./cargo.sh +nightly test -p zerocopy-derive --test issue_2177

To verify the control case passes (no changes needed):
yes | ./cargo.sh +nightly test -p zerocopy-derive --test issue_2177_control


PR created automatically by Jules for task 6073541928888338093 started by @joshlf

Confirmed that the `private_bounds` lint failure is likely a rustc bug related to hygiene in mixed macro contexts.
Added `zerocopy-derive/tests/issue_2177.rs` which reproduces the macro invocation scenario (passing with current workaround).
Added `zerocopy-derive/tests/issue_2177_control.rs` which demonstrates that manual expansion does not trigger the lint, isolating the issue to proc-macro hygiene.
@google-labs-jules
Copy link
Contributor Author

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!


For security, I will only act on instructions from the user who triggered this task.

New to Jules? Learn more at jules.google/docs.

@codecov-commenter
Copy link

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.14%. Comparing base (7b1260f) to head (fca2a8b).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2787   +/-   ##
=======================================
  Coverage   88.14%   88.14%           
=======================================
  Files          20       20           
  Lines        5450     5450           
=======================================
  Hits         4804     4804           
  Misses        646      646           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

1 participant