-
Notifications
You must be signed in to change notification settings - Fork 344
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
Implement <<
and <<=
for all uints
#1723
Conversation
impl IntImpl<'_> for Uint64 {} | ||
impl IntImpl<'_> for Uint128 {} | ||
impl IntImpl<'_> for Uint256 {} | ||
impl IntImpl<'_> for Uint512 {} |
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.
Can we remove impl AllImpl<'_> for Uint512 {}
and friends now? They should be required implicitly through the supertrait.
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.
Only if we copy all the bounds from AllImpl
to IntImpl
. The way it is right now, IntImpl
requires that they have AllImpl
too.
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.
I'm referring to line 67-70 in the new code. There we implement
impl AllImpl<'_> for Uint64 {}
impl AllImpl<'_> for Uint128 {}
impl AllImpl<'_> for Uint256 {}
impl AllImpl<'_> for Uint512 {}
which requires the Uint* types to implement the AllImpl
traits. However, line 71-74 should imply that.
E.g. impl IntImpl<'_> for Uint64 {}
failes to compile if Uint64 misses Add<&'a Self>
since IntImpl requires AllImpl which requires Add<&'a Self>
.
Or am I missing something here?
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.
I know what you mean, but that's not how it works. Let's use Uint64
as an example: Line 71 implies that it implements AllImpl
and all the Sh*
traits. If we remove line 67, then it does not implement AllImpl
anymore and line 71 will fail to compile. AllImpl
does not get automatically implemented just because all the bounds are implemented.
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.
Right you are, amen
Co-authored-by: Simon Warta <2603011+webmaster128@users.noreply.github.com>
Ah, some CHANGELOG entry would be nice |
closes #1712