-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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 leading_ones and trailing_ones methods to the primitive integer types #68165
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. |
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 |
Uh, it's mad about the |
It's fine for CI to be failing for now, once we get libs team signoff (i.e., @sfackler reviews this) then we can move ahead with filing a tracking issue and so forth. |
Tracking issue should be #57969, just reopen it. |
Seem reasonble to me. r=me with the tracking issue updated. |
I think I've done what was asked? I don't think I can reopen the tracking issue though. |
You could always creat a new one. |
I reopened the tracking issue. @bors r=sfackler |
📌 Commit 783a7dc has been approved by |
Add leading_ones and trailing_ones methods to the primitive integer types I was surprised these were missing (given that `leading_zeros` and `trailing_zeros` exist), and they seem trivial and hopefully not controversial. Note that there's some precedent in that `count_ones` and `count_zeros` are both supported even though only one of these has an intrinsic. I'm not sure if these need a `rustc_const_unstable` flag (the tests don't seem to mind that it's missing). I just made them const, since there's not really any reason for these to be non-const when the `_zeros` variants are const. Note: My understanding is trivial stuff like (hopefully) this can land without an RFC, but I'm not fully sure about the process though. Questions like "when does the tracking issue get filed?", are a total mystery to me. So, any guidance is appreciated, and sorry in advance if I should have gone through some more involved process for this.
☀️ Test successful - checks-azure |
📣 Toolstate changed by #68165! Tested on commit 1d5f6d4. 🎉 rustc-guide on linux: test-fail → test-pass (cc @JohnTitor @amanjeev @spastorino @mark-i-m, @rust-lang/infra). |
Tested on commit rust-lang/rust@1d5f6d4. Direct link to PR: <rust-lang/rust#68165> 🎉 rustc-guide on linux: test-fail → test-pass (cc @JohnTitor @amanjeev @spastorino @mark-i-m, @rust-lang/infra).
I was surprised these were missing (given that
leading_zeros
andtrailing_zeros
exist), and they seem trivial and hopefully not controversial.Note that there's some precedent in that
count_ones
andcount_zeros
are both supported even though only one of these has an intrinsic.I'm not sure if these need a
rustc_const_unstable
flag (the tests don't seem to mind that it's missing). I just made them const, since there's not really any reason for these to be non-const when the_zeros
variants are const.Note: My understanding is trivial stuff like (hopefully) this can land without an RFC, but I'm not fully sure about the process though. Questions like "when does the tracking issue get filed?", are a total mystery to me. So, any guidance is appreciated, and sorry in advance if I should have gone through some more involved process for this.