-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
Fix #49660 - Adds checks to ensure existence of arithmetic trait implementations #78259
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @sfackler (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
r? @KodrAus |
Ping from triage |
This looks like a great safety net to me! r=me after a rebase |
@KodrAus I was actually working on this just now... I've merged and fixed the conflicts. Please take a look |
@plaflamme Looks good to me! Would you like to squash these commits down (we try to avoid any merge commits if we can) then it should be good to go. r=me after that. |
AFAIK it isn't currently possible to do this. It is also more in line with other tests in the surrounding modules.
These tests invoke the various op traits using all accepted types they are implemented for as well as for references to those types. This fixes rust-lang#49660 and ensures the following implementations exist: * `Add`, `Sub`, `Mul`, `Div`, `Rem` * `T op T`, `T op &T`, `&T op T` and `&T op &T` * for all integer and floating point types * `AddAssign`, `SubAssign`, `MulAssign`, `DivAssign`, `RemAssign` * `&mut T op T` and `&mut T op &T` * for all integer and floating point types * `Neg` * `op T` and `op &T` * for all signed integer and floating point types * `Not` * `op T` and `op &T` * for `bool` * `BitAnd`, `BitOr`, `BitXor` * `T op T`, `T op &T`, `&T op T` and `&T op &T` * for all integer types and bool * `BitAndAssign`, `BitOrAssign`, `BitXorAssign` * `&mut T op T` and `&mut T op &T` * for all integer types and bool * `Shl`, `Shr` * `L op R`, `L op &R`, `&L op R` and `&L op &R` * for all pairs of integer types * `ShlAssign`, `ShrAssign` * `&mut L op R`, `&mut L op &R` * for all pairs of integer types
@KodrAus I've rebased and force pushed, removing the merge commit. Let me know if you'd like me to squash all of them. I kept the ones affecting |
Thanks @plaflamme! @bors r+ |
📌 Commit 64d695b has been approved by |
☀️ Test successful - checks-actions |
The first 2 commits fix an issue with the existing
wrapping.rs
tests. It wasn't referred to from the module, so the file was being ignored. This is fixed in 872dc60 This surfaced a bug in its macro which is fixed in 8ddad18Lastly, commit 64d695b is the actual tests for fixing #49660
The following checks are done:
Add
,Sub
,Mul
,Div
,Rem
T op T
,T op &T
,&T op T
and&T op &T
AddAssign
,SubAssign
,MulAssign
,DivAssign
,RemAssign
&mut T op T
and&mut T op &T
Neg
op T
andop &T
Not
op T
andop &T
bool
BitAnd
,BitOr
,BitXor
T op T
,T op &T
,&T op T
and&T op &T
BitAndAssign
,BitOrAssign
,BitXorAssign
&mut T op T
and&mut T op &T
Shl
,Shr
L op R
,L op &R
,&L op R
and&L op &R
ShlAssign
,ShrAssign
&mut L op R
,&mut L op &R
NOTE: I'd like some feedback on improving the macros. I'm not familiar with the idioms and patterns there and composing them has been a challenge for me.
[EDIT]: updated links to commits after rebase.