-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Add missing Wrapping methods, use doc_comment! #50465
Conversation
r? @KodrAus (rust_highfive has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
The implementation of Tne name and expectation from the other wrapping methods would make one to expect that when |
There doesn’t seem to be any conclusion in that thread. |
To give an actual counter-argument to current behaviour of it wrapping to |
I'm a bit confused; wouldn't Not 100% sure what you're trying to do here. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
2d12aaf
to
d0dfacc
Compare
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
e434306
to
a00e68d
Compare
@clarcharr rewriting such code in terms of ctlz is definitely possible, however it is harder to do if you want the "wrapping" power of two behaviour and the resulting code will be less obvious than the obvious solution that uses the wrapping power-of-two. One definition that would support the current implementation would be
Then doing a But in that case we must, in very clear manner warn users that this doesn’t always result in an actual power-of-two being returned. |
That is fair, and I'll update the documentation for it. Also as a precaution, I'll give it a different feature flag to make it clear that it should be discussed more in depth during stabilisation. |
Ping from triage! What's the status of this PR? |
@pietroalbini I still need to separate out the IMHO merging the next power of two functions now is okay because they're unstable, but a separate feature flag should mention that the behaviour might change for reasons @nagisa mentioned. |
Updated those methods with a separate feature flag, also added a |
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
Ping from triage @KodrAus! This PR needs your review. |
Thanks @clarcharr! So looking back through the history it looks like we haven't quite got a concrete use-case to base the wrapping power of two methods on but have at least reached a point where their behaviour is well communicated so we could add a note to the tracking issue to look at them again before stabilization. So that seems good to me. @clarcharr Sorry, where are we implementing |
@KodrAus Right now the |
Ah gotcha 👍 That shouldn't be a problem for anyone. This looks good to me, I'll add a note to the tracking issue. Thanks @clarcharr! @bors r+ |
📌 Commit 99cf5a9 has been approved by |
Add missing Wrapping methods, use doc_comment! Re-opened version of #49393 . Finishing touches for #32463. Note that this adds `Shl` and `Shr` implementations for `Wrapping<i128>` and `Wrapping<u128>`, which were previously missed. This is technically insta-stable, but I don't know why this would be a problem.
☀️ Test successful - status-appveyor, status-travis |
Re-opened version of #49393 . Finishing touches for #32463.
Note that this adds
Shl
andShr
implementations forWrapping<i128>
andWrapping<u128>
, which were previously missed. This is technically insta-stable, but I don't know why this would be a problem.