Skip to content
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

Merged
merged 3 commits into from
Jan 27, 2020

Conversation

thomcc
Copy link
Member

@thomcc thomcc commented Jan 12, 2020

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.

@rust-highfive
Copy link
Collaborator

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.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 12, 2020
@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-7 of your PR failed (pretty log, raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
2020-01-12T22:59:22.8626142Z ##[command]git remote add origin https://github.com/rust-lang/rust
2020-01-12T22:59:22.8714535Z ##[command]git config gc.auto 0
2020-01-12T22:59:22.8763998Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2020-01-12T22:59:22.8823552Z ##[command]git config --get-all http.proxy
2020-01-12T22:59:22.8960278Z ##[command]git -c http.extraheader="AUTHORIZATION: basic ***" fetch --force --tags --prune --progress --no-recurse-submodules --depth=2 origin +refs/heads/*:refs/remotes/origin/* +refs/pull/68165/merge:refs/remotes/pull/68165/merge
---
2020-01-12T23:04:46.5662187Z * 588 error codes
2020-01-12T23:04:46.5663186Z * highest error code: E0745
2020-01-12T23:04:46.6255245Z thread 'main' panicked at 'assertion failed: `(left != right)`
2020-01-12T23:04:46.6262014Z   left: `0`,
2020-01-12T23:04:46.6271921Z  right: `0`: "none" should be used when there is no issue, not "0"', src/tools/tidy/src/features.rs:417:21
2020-01-12T23:04:46.6272172Z 
2020-01-12T23:04:46.6272198Z 
2020-01-12T23:04:46.6272198Z 
2020-01-12T23:04:46.6327210Z command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/tidy" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/tidy" "/checkout/src" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "--no-vendor"
2020-01-12T23:04:46.6327382Z 
2020-01-12T23:04:46.6327437Z 
2020-01-12T23:04:46.6327500Z failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test src/tools/tidy
2020-01-12T23:04:46.6327550Z Build completed unsuccessfully in 0:01:29
2020-01-12T23:04:46.6327550Z Build completed unsuccessfully in 0:01:29
2020-01-12T23:04:46.6357025Z == clock drift check ==
2020-01-12T23:04:46.6357105Z   local time: Sun Jan 12 23:04:46 UTC 2020
2020-01-12T23:04:46.9198906Z   network time: Sun, 12 Jan 2020 23:04:46 GMT
2020-01-12T23:04:46.9199012Z == end clock drift check ==
2020-01-12T23:04:47.6672070Z 
2020-01-12T23:04:47.6796371Z ##[error]Bash exited with code '1'.
2020-01-12T23:04:47.6834069Z ##[section]Starting: Checkout
2020-01-12T23:04:47.6835561Z ==============================================================================
2020-01-12T23:04:47.6835610Z Task         : Get sources
2020-01-12T23:04:47.6835651Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.

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 @TimNN. (Feature Requests)

@thomcc
Copy link
Member Author

thomcc commented Jan 13, 2020

Uh, it's mad about the #[unstable(..., issue = "0")], which seems fair. Should I fix that by filing a tracking issue and putting it in? Or should I put none for now, and wait to get some form of goahead for filing the tracking issue

@Mark-Simulacrum
Copy link
Member

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.

@crlf0710
Copy link
Member

Tracking issue should be #57969, just reopen it.

@sfackler
Copy link
Member

Seem reasonble to me. r=me with the tracking issue updated.

src/libcore/num/mod.rs Outdated Show resolved Hide resolved
@JohnCSimon
Copy link
Member

JohnCSimon commented Jan 26, 2020

Ping from triage:
@sfackler @thomcc What is the status of this PR? It's sat idle for over a week.

@thomcc
Copy link
Member Author

thomcc commented Jan 26, 2020

I think I've done what was asked? I don't think I can reopen the tracking issue though.

@tesuji
Copy link
Contributor

tesuji commented Jan 26, 2020

You could always creat a new one.

@LukasKalbertodt
Copy link
Member

I reopened the tracking issue.

@bors r=sfackler

@bors
Copy link
Contributor

bors commented Jan 27, 2020

📌 Commit 783a7dc has been approved by sfackler

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 27, 2020
@bors
Copy link
Contributor

bors commented Jan 27, 2020

⌛ Testing commit 783a7dc with merge 1d5f6d4...

bors added a commit that referenced this pull request Jan 27, 2020
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.
@bors
Copy link
Contributor

bors commented Jan 27, 2020

☀️ Test successful - checks-azure
Approved by: sfackler
Pushing 1d5f6d4 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jan 27, 2020
@bors bors merged commit 783a7dc into rust-lang:master Jan 27, 2020
@rust-highfive
Copy link
Collaborator

📣 Toolstate changed by #68165!

Tested on commit 1d5f6d4.
Direct link to PR: #68165

🎉 rustc-guide on linux: test-fail → test-pass (cc @JohnTitor @amanjeev @spastorino @mark-i-m, @rust-lang/infra).

rust-highfive added a commit to rust-lang-nursery/rust-toolstate that referenced this pull request Jan 27, 2020
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).
@thomcc thomcc deleted the lt_ones branch February 6, 2020 17:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants