-
Couldn't load subscription status.
- Fork 128
Make errors Clone and relax PartialEq/Eq bounds #2715
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2715 +/- ##
==========================================
- Coverage 88.91% 88.17% -0.75%
==========================================
Files 20 20
Lines 5422 5470 +48
==========================================
+ Hits 4821 4823 +2
- Misses 601 647 +46 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
ee6a7f0 to
04a213e
Compare
04a213e to
ad7b081
Compare
ad7b081 to
cd391b4
Compare
9c5b321 to
79ec664
Compare
Manually implement PartialEq, Eq and Clone for types using SendSyncPhantomData. This is necessary because the default derive imposes an additional PartialEq/Eq/Clone bounds on the phantom type.
79ec664 to
9e6dc73
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me, thanks so much for the effort in putting it together!
I'm going to wait to merge until @jswrenn has also had a change to take a look, as he has stronger opinions about error code than I do.
|
/gemini review |
|
@gemini Do you have any suggestions to make this PR better? |
|
(@raldone01 I'm just using this PR to test our new gemini AI review integration – sorry for the noise) |
|
/gemini review |
There was a problem hiding this 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 makes the error types cloneable and relaxes their PartialEq and Eq bounds, which is a great improvement for usability. The implementation is correct and well-tested. I've also included some suggestions to simplify the code by using #[derive] for Clone, PartialEq, and Eq on the error structs, which is now possible due to the changes made to SendSyncPhantomData. The PR also includes several helpful typo fixes across the codebase. Overall, great work!
|
(Obviously ignore Gemini's very dumb suggestions.) |
The first commit fixes minor spelling mistakes I noticed.
The second one makes errors clone.
I have been writing a few crates using zerocopy and I frequently want to include
SizeErrorwith a mapped source in my error types but it is notClonewhich is very inconvenient.I rolled my own error type for now but it would be nice to just utilize the fancy printing zerocopy already does for errors.