Closed
Description
The other day I noticed that Wrapping
only implements Shl
and co. for usize
, which contradicts that without Wrapping
the shift amount can be any type. So, I think it may be useful to create tests which use macros to shove together all the types we expect to have impls for and check that we're consistent there.
What I've noticed:
- For every operation three extra impls are added, with the combinations of single-level references on both sides, e.g.
&T + T
,T + &T
,&T + &T
forAdd
. - Assignment ops do the same as the above, with only one extra impl, e.g.
T += &T
forAdd
. Add
,Sub
,Mul
,Div
,Rem
exist for all int and float types with themselvesBitAnd
,BitOr
,BitXor
exist for all int types and boolShl
andShr
allow any integer type for both the left and the right sideNeg
exists for all ints and floatsNot
exists for all ints and boolWrapping
should mimic all of the above, where references are of the form&Wrapping<T>
and notWrapping<&T>
.
Like, I wouldn't be surprised if rearranging some macros might add or remove impls for these and adding comprehensive tests might help make sure we covered everything.
Metadata
Metadata
Assignees
Labels
Area: The testsuite used to check the correctness of rustcCategory: An issue proposing an enhancement or a PR with one.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.Relevant to the compiler team, which will review and decide on the PR/issue.