Skip to content

Conversation

@google-labs-jules
Copy link
Contributor

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

Fixes an issue where deriving zerocopy traits on deprecated structs would emit warnings about "use of deprecated item".

This PR adds #[allow(deprecated)] to:

  • derive_known_layout's Field implementations.
  • derive_known_layout's internal MaybeUninit struct.
  • derive_known_layout's KnownLayout impl for the internal struct.
  • derive_hash implementation (was missing).
  • derive_eq implementation (was missing).

It also adds regression tests in zerocopy-derive/tests/deprecated.rs which define deprecated types and derive various traits, ensuring no warnings are emitted (the tests have #![deny(deprecated)]).

Closes #553


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

Our derives now properly emit `#[allow(deprecated)]` in all locations where user code might be referenced, suppressing warnings when deriving traits on deprecated types.

This change adds regression tests for `ByteHash`, `ByteEq`, and `SplitAt` (and implicitly `KnownLayout` via `SplitAt`) to ensure this behavior is preserved. It also fixes missing suppressions in `KnownLayout`'s internal helpers (`Field` impls and `__ZerocopyKnownLayoutMaybeUninit` struct).
@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.

@joshlf joshlf marked this pull request as ready for review November 22, 2025 04:39
@joshlf joshlf enabled auto-merge November 22, 2025 04:39
joshlf
joshlf previously approved these changes Nov 22, 2025
@codecov-commenter
Copy link

codecov-commenter commented Nov 22, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.14%. Comparing base (a9e527a) to head (9c1f7b7).

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

Our derives now properly emit `#[allow(deprecated)]` in all locations where user code might be referenced, suppressing warnings when deriving traits on deprecated types.

This change adds regression tests for `ByteHash`, `ByteEq`, and `SplitAt` (and implicitly `KnownLayout` via `SplitAt`) to ensure this behavior is preserved. It also fixes missing suppressions in `KnownLayout`'s internal helpers (`Field` impls and `__ZerocopyKnownLayoutMaybeUninit` struct).
@joshlf joshlf self-requested a review November 22, 2025 04:48
@joshlf joshlf dismissed their stale review November 22, 2025 04:49

Dismissing so that others can review

@joshlf joshlf requested review from jswrenn and removed request for joshlf November 22, 2025 04:54
Our derives now properly emit `#[allow(deprecated)]` in all locations where user code might be referenced, suppressing warnings when deriving traits on deprecated types.

This change adds regression tests for `ByteHash`, `ByteEq`, and `SplitAt` (and implicitly `KnownLayout` via `SplitAt`) to ensure this behavior is preserved. It also fixes missing suppressions in `KnownLayout`'s internal helpers (`Field` impls and `__ZerocopyKnownLayoutMaybeUninit` struct).
@joshlf joshlf added this pull request to the merge queue Nov 24, 2025
Merged via the queue into main with commit 9483f7d Nov 24, 2025
98 checks passed
@joshlf joshlf deleted the fix-deprecated-warnings-v2 branch November 24, 2025 21:09
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.

Don't generate warning when deriving on deprecated type

3 participants