Skip to content

Conversation

@google-labs-jules
Copy link
Contributor

@google-labs-jules google-labs-jules bot commented Nov 21, 2025

We emit a private_bounds lint in KnownLayout derive to fix false positives when used in macro_rules!. This PR adds a regression test in zerocopy-derive/tests/hygiene.rs.

Closes #2177


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

This commit suppresses the `private_bounds` lint on the `__ZerocopyKnownLayoutMaybeUninit` struct generated by `#[derive(KnownLayout)]`. This lint can be falsely triggered when the derive macro is used on a public struct within a `macro_rules!` macro, where the generated code refers to private types (field indices) that are technically "more private" than the public struct, even though they are in the same module scope.

Fixes #2177.
@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-commenter commented Nov 21, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.14%. Comparing base (8f443eb) to head (d750a65).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2791   +/-   ##
=======================================
  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.

This commit suppresses the `private_bounds` lint on the `__ZerocopyKnownLayoutMaybeUninit` struct generated by `#[derive(KnownLayout)]`. This lint can be falsely triggered when the derive macro is used on a public struct within a `macro_rules!` macro, where the generated code refers to private types (field indices) that are technically "more private" than the public struct, even though they are in the same module scope.

Fixes #2177.
@joshlf joshlf changed the title Suppress private_bounds lint in KnownLayout derive Add regression test for suppressing private_bounds lint in KnownLayout derive Nov 21, 2025
@joshlf joshlf marked this pull request as ready for review November 21, 2025 21:16
@joshlf joshlf enabled auto-merge November 21, 2025 21:16
@joshlf joshlf requested a review from jswrenn November 21, 2025 21:20
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.

Inconsistent visibility on some derive-synthesized types

1 participant