Skip to content

Conversation

@joshlf
Copy link
Member

@joshlf joshlf commented Jan 8, 2026

Makes progress on #5
Closes #1831
Closes #1832


Latest Update: v86 — Compare vs v85

📚 Full Patch History

Links show the diff between the row version and the column version.

Version v85 v84 v83 v82 v81 v80 v79 v78 v77 v76 v75 v74 v73 v72 v71 v70 v69 v68 v67 v66 v65 v64 v63 v62 v61 v60 v59 v58 v57 v56 v55 v54 v53 v52 v51 v50 v49 v48 v47 v46 v45 v44 v43 v42 v41 v40 v39 v38 v37 v36 v35 v34 v33 v32 v31 v30 v29 v28 v27 v26 v25 v24 v23 v22 v21 v20 v19 v18 v17 v16 v15 v14 v13 v12 v11 v10 v9 v8 v7 v6 v5 v4 v3 v2 v1 Base
v86 v85 v84 v83 v82 v81 v80 v79 v78 v77 v76 v75 v74 v73 v72 v71 v70 v69 v68 v67 v66 v65 v64 v63 v62 v61 v60 v59 v58 v57 v56 v55 v54 v53 v52 v51 v50 v49 v48 v47 v46 v45 v44 v43 v42 v41 v40 v39 v38 v37 v36 v35 v34 v33 v32 v31 v30 v29 v28 v27 v26 v25 v24 v23 v22 v21 v20 v19 v18 v17 v16 v15 v14 v13 v12 v11 v10 v9 v8 v7 v6 v5 v4 v3 v2 v1 Base
v85 v84 Base
v84 v83 Base
v83 v82 Base
v82 v81 Base
v81 v80 Base
v80 v79 Base
v79 v78 Base
v78 v77 Base
v77 v76 Base
v76 v75 Base
v75 v74 Base
v74 v73 Base
v73 v72 Base
v72 v71 Base
v71 v70 Base
v70 v69 Base
v69 v68 Base
v68 v67 Base
v67 v66 Base
v66 v65 Base
v65 v64 Base
v64 v63 Base
v63 v62 Base
v62 v61 Base
v61 v60 Base
v60 v59 Base
v59 v58 Base
v58 v57 Base
v57 v56 Base
v56 v55 Base
v55 v54 Base
v54 v53 Base
v53 v52 Base
v52 v51 Base
v51 v50 Base
v50 v49 Base
v49 v48 Base
v48 v47 Base
v47 v46 Base
v46 v45 Base
v45 v44 Base
v44 v43 Base
v43 v42 Base
v42 v41 Base
v41 v40 Base
v40 v39 Base
v39 v38 Base
v38 v37 Base
v37 v36 Base
v36 v35 Base
v35 v34 Base
v34 v33 Base
v33 v32 Base
v32 v31 Base
v31 v30 Base
v30 v29 Base
v29 v28 Base
v28 v27 Base
v27 v26 Base
v26 v25 Base
v25 v24 Base
v24 v23 Base
v23 v22 Base
v22 v21 Base
v21 v20 Base
v20 v19 Base
v19 v18 Base
v18 v17 Base
v17 v16 Base
v16 v15 Base
v15 v14 Base
v14 v13 Base
v13 v12 Base
v12 v11 Base
v11 v10 Base
v10 v9 Base
v9 v8 Base
v8 v7 Base
v7 v6 Base
v6 v5 Base
v5 v4 Base
v4 v3 Base
v3 v2 Base
v2 v1 Base
v1 Base

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @joshlf, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the flexibility of the zerocopy crate by removing the Immutable trait requirement for deriving TryFromBytes, FromZeros, and FromBytes for unions. This change allows unions containing types like UnsafeCell, which are not inherently Immutable, to correctly implement these traits, broadening the utility of the derive macros without compromising memory safety.

Highlights

  • Removed Immutable Trait Bound for Unions: The Immutable trait bound has been removed for TryFromBytes, FromZeros, and FromBytes derives on unions, allowing these derives to be used with unions containing non-Immutable types.
  • Updated Safety Justification: The safety comment for TryFromBytes on unions has been updated to clarify that safety is ensured by ReadOnly<Self>: Immutable, which holds unconditionally, rather than Self: Immutable.
  • New Test Cases for UnsafeCell Unions: New test cases have been added for unions containing UnsafeCell to validate the updated derive behavior for FromBytes, FromZeros, and TryFromBytes.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request correctly removes the Immutable bound requirement for fields of unions when deriving TryFromBytes, FromZeros, and FromBytes. This is a significant improvement that allows unions containing types with interior mutability (like UnsafeCell) to use these derives. The implementation ensures safety by using a ReadOnly wrapper during validity checks, and the corresponding safety comments are updated accordingly. The change is supported by new tests that verify the new functionality. The implementation is sound and the code quality is high.

@joshlf joshlf force-pushed the G0d92654de6e9a8c16ac830e35adf298a1b486df4 branch from 21a1122 to b220dc0 Compare January 8, 2026 19:34
@joshlf joshlf force-pushed the G27dd847426e3572e87b20bd64642c9fcb0e51ec8 branch from 2563db5 to 933a997 Compare January 8, 2026 19:34
@joshlf joshlf force-pushed the G0d92654de6e9a8c16ac830e35adf298a1b486df4 branch from b220dc0 to e7e1674 Compare January 8, 2026 19:40
@joshlf joshlf force-pushed the G27dd847426e3572e87b20bd64642c9fcb0e51ec8 branch 2 times, most recently from b886722 to fe1e718 Compare January 8, 2026 19:50
@joshlf joshlf force-pushed the G0d92654de6e9a8c16ac830e35adf298a1b486df4 branch from e7e1674 to 6321cc7 Compare January 8, 2026 19:50
@codecov-commenter
Copy link

codecov-commenter commented Jan 8, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.30%. Comparing base (a7d3fda) to head (f0942c1).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2876   +/-   ##
=======================================
  Coverage   92.30%   92.30%           
=======================================
  Files          19       19           
  Lines        5849     5849           
=======================================
  Hits         5399     5399           
  Misses        450      450           

☔ 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.

@joshlf joshlf force-pushed the G0d92654de6e9a8c16ac830e35adf298a1b486df4 branch from 6321cc7 to dd15299 Compare January 9, 2026 00:00
@joshlf joshlf force-pushed the G27dd847426e3572e87b20bd64642c9fcb0e51ec8 branch from fe1e718 to 050ea06 Compare January 9, 2026 00:00
@joshlf joshlf force-pushed the G27dd847426e3572e87b20bd64642c9fcb0e51ec8 branch from 050ea06 to 2972d07 Compare January 9, 2026 16:57
@joshlf joshlf changed the base branch from G0d92654de6e9a8c16ac830e35adf298a1b486df4 to G7691845b6b02e9f3d9578435d732bacfa6ca674f January 9, 2026 16:57
@joshlf joshlf force-pushed the G7691845b6b02e9f3d9578435d732bacfa6ca674f branch from 5cf70a2 to e6fab2d Compare January 9, 2026 17:04
@joshlf joshlf force-pushed the G27dd847426e3572e87b20bd64642c9fcb0e51ec8 branch from 2972d07 to f5919bc Compare January 9, 2026 17:04
@joshlf joshlf force-pushed the G7691845b6b02e9f3d9578435d732bacfa6ca674f branch from e6fab2d to 6a4dcd8 Compare January 9, 2026 17:22
@joshlf joshlf force-pushed the G27dd847426e3572e87b20bd64642c9fcb0e51ec8 branch from f5919bc to 9562030 Compare January 9, 2026 17:22
@joshlf joshlf force-pushed the G7691845b6b02e9f3d9578435d732bacfa6ca674f branch from 6a4dcd8 to 3a76740 Compare January 15, 2026 23:32
@joshlf joshlf force-pushed the G27dd847426e3572e87b20bd64642c9fcb0e51ec8 branch from 9562030 to 625fa9b Compare January 15, 2026 23:32
@joshlf joshlf force-pushed the G7691845b6b02e9f3d9578435d732bacfa6ca674f branch from 3a76740 to 0873766 Compare January 16, 2026 00:02
@joshlf joshlf force-pushed the G27dd847426e3572e87b20bd64642c9fcb0e51ec8 branch from 625fa9b to 74741ec Compare January 16, 2026 00:02
@joshlf joshlf force-pushed the G7691845b6b02e9f3d9578435d732bacfa6ca674f branch from 0873766 to 4119ee4 Compare January 16, 2026 00:29
@joshlf joshlf force-pushed the G7691845b6b02e9f3d9578435d732bacfa6ca674f branch from cd2beea to 7d3d321 Compare January 27, 2026 18:46
@joshlf joshlf force-pushed the G27dd847426e3572e87b20bd64642c9fcb0e51ec8 branch from cce1ad7 to 9d11ef4 Compare January 27, 2026 18:46
@joshlf joshlf force-pushed the G7691845b6b02e9f3d9578435d732bacfa6ca674f branch from 7d3d321 to f83a061 Compare January 27, 2026 18:49
@joshlf joshlf force-pushed the G27dd847426e3572e87b20bd64642c9fcb0e51ec8 branch from 9d11ef4 to d7f7ca5 Compare January 27, 2026 18:49
@joshlf joshlf force-pushed the G7691845b6b02e9f3d9578435d732bacfa6ca674f branch from f83a061 to dad9c64 Compare January 27, 2026 18:55
@joshlf joshlf force-pushed the G27dd847426e3572e87b20bd64642c9fcb0e51ec8 branch from d7f7ca5 to 4e45fa9 Compare January 27, 2026 18:55
@joshlf joshlf force-pushed the G7691845b6b02e9f3d9578435d732bacfa6ca674f branch from dad9c64 to beb77bf Compare January 27, 2026 19:03
@joshlf joshlf force-pushed the G27dd847426e3572e87b20bd64642c9fcb0e51ec8 branch from 4e45fa9 to 659dc88 Compare January 27, 2026 19:03
@joshlf
Copy link
Member Author

joshlf commented Jan 27, 2026

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request successfully addresses the FIXME(#5) comments by removing the Immutable bound from the derive_from_zeros_union, derive_from_bytes_union, and derive_try_from_bytes_union functions. The safety comments have been updated to reflect this change, and new test cases for UnsafeCellUnion have been added to validate that unions containing non-Immutable types can now correctly derive these traits. The changes are well-implemented and thoroughly tested.

@joshlf joshlf force-pushed the G7691845b6b02e9f3d9578435d732bacfa6ca674f branch from beb77bf to 54942f9 Compare January 27, 2026 19:26
@joshlf joshlf force-pushed the G27dd847426e3572e87b20bd64642c9fcb0e51ec8 branch 2 times, most recently from 422dafb to a06923d Compare January 27, 2026 19:44
@joshlf joshlf force-pushed the G7691845b6b02e9f3d9578435d732bacfa6ca674f branch from 54942f9 to 4a46118 Compare January 27, 2026 19:44
@joshlf joshlf force-pushed the G27dd847426e3572e87b20bd64642c9fcb0e51ec8 branch from a06923d to 92129fa Compare January 27, 2026 19:46
@joshlf joshlf force-pushed the G7691845b6b02e9f3d9578435d732bacfa6ca674f branch 2 times, most recently from 2096433 to 9477a95 Compare January 27, 2026 19:59
@joshlf joshlf force-pushed the G27dd847426e3572e87b20bd64642c9fcb0e51ec8 branch from 92129fa to 128171d Compare January 27, 2026 19:59
@joshlf joshlf force-pushed the G27dd847426e3572e87b20bd64642c9fcb0e51ec8 branch from 128171d to 5bdeb60 Compare January 27, 2026 20:21
@joshlf joshlf force-pushed the G7691845b6b02e9f3d9578435d732bacfa6ca674f branch from 9477a95 to 0c202f7 Compare January 27, 2026 20:21
Base automatically changed from G7691845b6b02e9f3d9578435d732bacfa6ca674f to main January 27, 2026 20:58
Makes progress on #5
Closes #1831
Closes #1832

gherrit-pr-id: G27dd847426e3572e87b20bd64642c9fcb0e51ec8
@joshlf joshlf force-pushed the G27dd847426e3572e87b20bd64642c9fcb0e51ec8 branch from 5bdeb60 to f0942c1 Compare January 27, 2026 21:02
@joshlf joshlf enabled auto-merge January 27, 2026 21:02
@joshlf joshlf added this pull request to the merge queue Jan 27, 2026
Merged via the queue into main with commit 84eaf29 Jan 27, 2026
104 checks passed
@joshlf joshlf deleted the G27dd847426e3572e87b20bd64642c9fcb0e51ec8 branch January 27, 2026 21:37
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.

Support #[derive(TryFromBytes)] on unions without requiring Self: Immutable TryFromBytes::is_bit_valid should promise not to mutate its referent

3 participants