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

implement .trailing_ones(), .leading_ones() #55715

Closed

Conversation

yoshuawuyts
Copy link
Member

@yoshuawuyts yoshuawuyts commented Nov 6, 2018

Hi!

This patch implements .trailing_ones() and .leading_ones() to all number types as counterparts to the .leading_zeros(), and .trailing_zeros() methods.

I posted a pre-RFC for these changes on internals, but the consensus seemed to be these changes would be small enough that no RFC was needed. So hence this patch!

I've never written a PR for Rustc before, so I hope I'm doing everything right. I realize this patch is probably not good enough to land as-is, so I had a few questions:

  • Should external tests be added, or are doctests enough? If yes: where should they be added?
  • I'm not sure what the right stability attribute would be for these methods. The tidy checks are pointing out it's malformed, but I'm not sure what the correct form would be.

Thanks heaps!

@rust-highfive
Copy link
Collaborator

@rust-highfive rust-highfive commented Nov 6, 2018

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @KodrAus (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 label Nov 6, 2018
src/libcore/num/mod.rs Outdated Show resolved Hide resolved
assert_eq!(n.leading_ones(), 0);",
$EndFeature, "
```"),
#[unstable(feature = "leading_ones_trailing_ones", issue = "0")]
Copy link
Member

@killercup killercup Nov 6, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not on the libs team but it might be a good idea to open an issue so you have a non-zero number you can refer to here :)

@yoshuawuyts yoshuawuyts force-pushed the trailing_ones_trailing_zeros branch 2 times, most recently from 88eec03 to 7fb7422 Compare Nov 6, 2018
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
@rust-highfive
Copy link
Collaborator

@rust-highfive rust-highfive commented Nov 6, 2018

The job x86_64-gnu-llvm-5.0 of your PR failed on Travis (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.
travis_time:end:1e8413b0:start=1541510648620989342,finish=1541510840203116873,duration=191582127531
$ git checkout -qf FETCH_HEAD
travis_fold:end:git.checkout

Encrypted environment variables have been removed for security reasons.
See https://docs.travis-ci.com/user/pull-requests/#Pull-Requests-and-Security-Restrictions
$ export SCCACHE_BUCKET=rust-lang-ci-sccache2
$ export SCCACHE_REGION=us-west-1
Setting environment variables from .travis.yml
$ export IMAGE=x86_64-gnu-llvm-5.0
---
[00:55:08] .................................................................................................... 100/4995
[00:55:11] .................................................................................................... 200/4995
[00:55:14] ........................................................................ii....................ii.... 300/4995
[00:55:17] ...........................................................................................iii...... 400/4995
[00:55:20] ..iiiiiiii.iii...........................iii...........................................i...........i 500/4995
[00:55:27] .................................................................................................... 700/4995
[00:55:33] ...................................................................i...........i.................... 800/4995
[00:55:36] ......................................................................................iiiii......... 900/4995
[00:55:40] .........ii.iiii.................................................................................... 1000/4995
---
[00:56:15] .................................................................................................... 2200/4995
[00:56:20] .................................................................................................... 2300/4995
[00:56:23] .................................................................................................... 2400/4995
[00:56:27] .................................................................................................... 2500/4995
[00:56:31] ............................................................................iiiiiiiii............... 2600/4995
[00:56:38] ...........................ii....................................................................... 2800/4995
[00:56:40] .................................................................................................... 2900/4995
[00:56:44] .................................................................................................... 3000/4995
[00:56:47] ......................i............................................................................. 3100/4995
---
travis_time:start:test_codegen
Check compiletest suite=codegen mode=codegen (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[01:10:56] 
[01:10:56] running 115 tests
[01:10:59] i..ii...iii..iii.....i...i.........i..iii...........i.....i.....ii...i..i.ii...............i..ii..ii 100/115
[01:10:59] .i....iiii.....
[01:10:59] 
[01:10:59]  finished in 3.533
[01:10:59] travis_fold:end:test_codegen

---
travis_time:start:test_debuginfo
Check compiletest suite=debuginfo mode=debuginfo-both (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[01:11:14] 
[01:11:14] running 118 tests
[01:11:37] .iiiii...i.....i..i...i..i.i..i.i..i.....i..i....i..........iiii.........i.i....i...i.......ii.i.i.i 100/118
[01:11:41] ......iii.i.....ii
[01:11:41] 
[01:11:41]  finished in 27.275
[01:11:41] travis_fold:end:test_debuginfo

---
[01:26:28] .................................................................................................... 200/2194
[01:26:41] .................................................................................................... 300/2194
[01:26:54] ..............................................i..................................................... 400/2194
[01:27:05] .................................................................................................... 500/2194
[01:27:15] .......F................................F.....................................F..................... 600/2194
[01:27:25] ...........F......................................F...............................F................. 700/2194
[01:27:36] ......................F.............................F.......................................F....... 800/2194
[01:27:47] ........................F.......................................F..............................F.... 900/2194
[01:27:58] ...............................F...............................F.................................... 1000/2194
[01:28:08] F..............................F....................................F.............................F. 1100/2194
[01:28:19] ...................................F...............................F................................ 1200/2194
[01:28:30] ................F...................................F...................................F........... 1300/2194
[01:28:41] ...................F................................................................................ 1400/2194
[01:29:02] .................................................................................................... 1600/2194
[01:29:13] .................................................................................................... 1700/2194
[01:29:25] .................................................................................................... 1800/2194
[01:29:38] .................................................................................................... 1900/2194
---
[01:30:20] ---- num/mod.rs - num::i128::leading_ones (line 45) stdout ----
[01:30:20] error[E0658]: use of unstable library feature 'leading_ones_trailing_ones'
[01:30:20]  --> num/mod.rs:48:14
[01:30:20]   |
[01:30:20] 6 | assert_eq!(n.leading_ones(), 1);
[01:30:20]   |
[01:30:20]   |
[01:30:20]   = help: add #![feature(leading_ones_trailing_ones)] to the crate attributes to enable
[01:30:20] thread 'num/mod.rs - num::i128::leading_ones (line 45)' panicked at 'couldn't compile the test', librustdoc/test.rs:323:13
[01:30:20] note: Run with `RUST_BACKTRACE=1` for a backtrace.
[01:30:20] 
[01:30:20] ---- num/mod.rs - num::i128::trailing_ones (line 45) stdout ----
[01:30:20] ---- num/mod.rs - num::i128::trailing_ones (line 45) stdout ----
[01:30:20] error[E0658]: use of unstable library feature 'leading_ones_trailing_ones'
[01:30:20]  --> num/mod.rs:48:14
[01:30:20]   |
[01:30:20] 6 | assert_eq!(n.trailing_ones(), 2);
[01:30:20]   |
[01:30:20]   |
[01:30:20]   = help: add #![feature(leading_ones_trailing_ones)] to the crate attributes to enable
[01:30:20] thread 'num/mod.rs - num::i128::trailing_ones (line 45)' panicked at 'couldn't compile the test', librustdoc/test.rs:323:13
[01:30:20] 
[01:30:20] ---- num/mod.rs - num::i16::leading_ones (line 45) stdout ----
[01:30:20] error[E0658]: use of unstable library feature 'leading_ones_trailing_ones'
[01:30:20] error[E0658]: use of unstable library feature 'leading_ones_trailing_ones'
[01:30:20]  --> num/mod.rs:48:14
[01:30:20]   |
[01:30:20] 6 | assert_eq!(n.leading_ones(), 1);
[01:30:20]   |
[01:30:20]   |
[01:30:20]   = help: add #![feature(leading_ones_trailing_ones)] to the crate attributes to enable
[01:30:20] thread 'num/mod.rs - num::i16::leading_ones (line 45)' panicked at 'couldn't compile the test', librustdoc/test.rs:323:13
[01:30:20] 
[01:30:20] ---- num/mod.rs - num::i16::trailing_ones (line 45) stdout ----
[01:30:20] error[E0658]: use of unstable library feature 'leading_ones_trailing_ones'
[01:30:20] error[E0658]: use of unstable library feature 'leading_ones_trailing_ones'
[01:30:20]  --> num/mod.rs:48:14
[01:30:20]   |
[01:30:20] 6 | assert_eq!(n.trailing_ones(), 2);
[01:30:20]   |
[01:30:20]   |
[01:30:20]   = help: add #![feature(leading_ones_trailing_ones)] to the crate attributes to enable
[01:30:20] thread 'num/mod.rs - num::i16::trailing_ones (line 45)' panicked at 'couldn't compile the test', librustdoc/test.rs:323:13
[01:30:20] 
[01:30:20] ---- num/mod.rs - num::i32::leading_ones (line 45) stdout ----
[01:30:20] error[E0658]: use of unstable library feature 'leading_ones_trailing_ones'
[01:30:20] error[E0658]: use of unstable library feature 'leading_ones_trailing_ones'
[01:30:20]  --> num/mod.rs:48:14
[01:30:20]   |
[01:30:20] 6 | assert_eq!(n.leading_ones(), 1);
[01:30:20]   |
[01:30:20]   |
[01:30:20]   = help: add #![feature(leading_ones_trailing_ones)] to the crate attributes to enable
[01:30:20] thread 'num/mod.rs - num::i32::leading_ones (line 45)' panicked at 'couldn't compile the test', librustdoc/test.rs:323:13
[01:30:20] 
[01:30:20] ---- num/mod.rs - num::i32::trailing_ones (line 45) stdout ----
[01:30:20] error[E0658]: use of unstable library feature 'leading_ones_trailing_ones'
[01:30:20] error[E0658]: use of unstable library feature 'leading_ones_trailing_ones'
[01:30:20]  --> num/mod.rs:48:14
[01:30:20]   |
[01:30:20] 6 | assert_eq!(n.trailing_ones(), 2);
[01:30:20]   |
[01:30:20]   |
[01:30:20]   = help: add #![feature(leading_ones_trailing_ones)] to the crate attributes to enable
[01:30:20] thread 'num/mod.rs - num::i32::trailing_ones (line 45)' panicked at 'couldn't compile the test', librustdoc/test.rs:323:13
[01:30:20] 
[01:30:20] ---- num/mod.rs - num::i64::leading_ones (line 45) stdout ----
[01:30:20] error[E0658]: use of unstable library feature 'leading_ones_trailing_ones'
[01:30:20] error[E0658]: use of unstable library feature 'leading_ones_trailing_ones'
[01:30:20]  --> num/mod.rs:48:14
[01:30:20]   |
[01:30:20] 6 | assert_eq!(n.leading_ones(), 1);
[01:30:20]   |
[01:30:20]   |
[01:30:20]   = help: add #![feature(leading_ones_trailing_ones)] to the crate attributes to enable
[01:30:20] thread 'num/mod.rs - num::i64::leading_ones (line 45)' panicked at 'couldn't compile the test', librustdoc/test.rs:323:13
[01:30:20] 
[01:30:20] ---- num/mod.rs - num::i64::trailing_ones (line 45) stdout ----
[01:30:20] error[E0658]: use of unstable library feature 'leading_ones_trailing_ones'
[01:30:20] error[E0658]: use of unstable library feature 'leading_ones_trailing_ones'
[01:30:20]  --> num/mod.rs:48:14
[01:30:20]   |
[01:30:20] 6 | assert_eq!(n.trailing_ones(), 2);
[01:30:20]   |
[01:30:20]   |
[01:30:20]   = help: add #![feature(leading_ones_trailing_ones)] to the crate attributes to enable
[01:30:20] thread 'num/mod.rs - num::i64::trailing_ones (line 45)' panicked at 'couldn't compile the test', librustdoc/test.rs:323:13
[01:30:20] 
[01:30:20] ---- num/mod.rs - num::i8::leading_ones (line 45) stdout ----
[01:30:20] error[E0658]: use of unstable library feature 'leading_ones_trailing_ones'
[01:30:20] error[E0658]: use of unstable library feature 'leading_ones_trailing_ones'
[01:30:20]  --> num/mod.rs:48:14
[01:30:20]   |
[01:30:20] 6 | assert_eq!(n.leading_ones(), 1);
[01:30:20]   |
[01:30:20]   |
[01:30:20]   = help: add #![feature(leading_ones_trailing_ones)] to the crate attributes to enable
[01:30:20] thread 'num/mod.rs - num::i8::leading_ones (line 45)' panicked at 'couldn't compile the test', librustdoc/test.rs:323:13
[01:30:20] 
[01:30:20] ---- num/mod.rs - num::i8::trailing_ones (line 45) stdout ----
[01:30:20] error[E0658]: use of unstable library feature 'leading_ones_trailing_ones'
[01:30:20] error[E0658]: use of unstable library feature 'leading_ones_trailing_ones'
[01:30:20]  --> num/mod.rs:48:14
[01:30:20]   |
[01:30:20] 6 | assert_eq!(n.trailing_ones(), 2);
[01:30:20]   |
[01:30:20]   |
[01:30:20]   = help: add #![feature(leading_ones_trailing_ones)] to the crate attributes to enable
[01:30:20] thread 'num/mod.rs - num::i8::trailing_ones (line 45)' panicked at 'couldn't compile the test', librustdoc/test.rs:323:13
[01:30:20] 
[01:30:20] ---- num/mod.rs - num::isize::leading_ones (line 45) stdout ----
[01:30:20] error[E0658]: use of unstable library feature 'leading_ones_trailing_ones'
[01:30:20] error[E0658]: use of unstable library feature 'leading_ones_trailing_ones'
[01:30:20]  --> num/mod.rs:48:14
[01:30:20]   |
[01:30:20] 6 | assert_eq!(n.leading_ones(), 1);
[01:30:20]   |
[01:30:20]   |
[01:30:20]   = help: add #![feature(leading_ones_trailing_ones)] to the crate attributes to enable
[01:30:20] thread 'num/mod.rs - num::isize::leading_ones (line 45)' panicked at 'couldn't compile the test', librustdoc/test.rs:323:13
[01:30:20] 
[01:30:20] ---- num/mod.rs - num::isize::trailing_ones (line 45) stdout ----
[01:30:20] error[E0658]: use of unstable library feature 'leading_ones_trailing_ones'
[01:30:20] error[E0658]: use of unstable library feature 'leading_ones_trailing_ones'
[01:30:20]  --> num/mod.rs:48:14
[01:30:20]   |
[01:30:20] 6 | assert_eq!(n.trailing_ones(), 2);
[01:30:20]   |
[01:30:20]   |
[01:30:20]   = help: add #![feature(leading_ones_trailing_ones)] to the crate attributes to enable
[01:30:20] thread 'num/mod.rs - num::isize::trailing_ones (line 45)' panicked at 'couldn't compile the test', librustdoc/test.rs:323:13
[01:30:20] 
[01:30:20] ---- num/mod.rs - num::u128::leading_ones (line 45) stdout ----
[01:30:20] error[E0658]: use of unstable library feature 'leading_ones_trailing_ones'
[01:30:20] error[E0658]: use of unstable library feature 'leading_ones_trailing_ones'
[01:30:20]  --> num/mod.rs:48:14
[01:30:20]   |
[01:30:20] 6 | assert_eq!(n.leading_ones(), 2);
[01:30:20]   |
[01:30:20]   |
[01:30:20]   = help: add #![feature(leading_ones_trailing_ones)] to the crate attributes to enable
[01:30:20] thread 'num/mod.rs - num::u128::leading_ones (line 45)' panicked at 'couldn't compile the test', librustdoc/test.rs:323:13
[01:30:20] 
[01:30:20] ---- num/mod.rs - num::u128::trailing_ones (line 46) stdout ----
[01:30:20] error[E0658]: use of unstable library feature 'leading_ones_trailing_ones'
[01:30:20] error[E0658]: use of unstable library feature 'leading_ones_trailing_ones'
[01:30:20]  --> num/mod.rs:49:14
[01:30:20]   |
[01:30:20] 6 | assert_eq!(n.trailing_ones(), 2);
[01:30:20]   |
[01:30:20]   |
[01:30:20]   = help: add #![feature(leading_ones_trailing_ones)] to the crate attributes to enable
[01:30:20] thread 'num/mod.rs - num::u128::trailing_ones (line 46)' panicked at 'couldn't compile the test', librustdoc/test.rs:323:13
[01:30:20] 
[01:30:20] ---- num/mod.rs - num::u16::leading_ones (line 45) stdout ----
[01:30:20] error[E0658]: use of unstable library feature 'leading_ones_trailing_ones'
[01:30:20] error[E0658]: use of unstable library feature 'leading_ones_trailing_ones'
[01:30:20]  --> num/mod.rs:48:14
[01:30:20]   |
[01:30:20] 6 | assert_eq!(n.leading_ones(), 2);
[01:30:20]   |
[01:30:20]   |
[01:30:20]   = help: add #![feature(leading_ones_trailing_ones)] to the crate attributes to enable
[01:30:20] thread 'num/mod.rs - num::u16::leading_ones (line 45)' panicked at 'couldn't compile the test', librustdoc/test.rs:323:13
[01:30:20] 
[01:30:20] ---- num/mod.rs - num::u16::trailing_ones (line 46) stdout ----
[01:30:20] error[E0658]: use of unstable library feature 'leading_ones_trailing_ones'
[01:30:20] error[E0658]: use of unstable library feature 'leading_ones_trailing_ones'
[01:30:20]  --> num/mod.rs:49:14
[01:30:20]   |
[01:30:20] 6 | assert_eq!(n.trailing_ones(), 2);
[01:30:20]   |
[01:30:20]   |
[01:30:20]   = help: add #![feature(leading_ones_trailing_ones)] to the crate attributes to enable
[01:30:20] thread 'num/mod.rs - num::u16::trailing_ones (line 46)' panicked at 'couldn't compile the test', librustdoc/test.rs:323:13
[01:30:20] 
[01:30:20] ---- num/mod.rs - num::u32::leading_ones (line 45) stdout ----
[01:30:20] error[E0658]: use of unstable library feature 'leading_ones_trailing_ones'
[01:30:20] error[E0658]: use of unstable library feature 'leading_ones_trailing_ones'
[01:30:20]  --> num/mod.rs:48:14
[01:30:20]   |
[01:30:20] 6 | assert_eq!(n.leading_ones(), 2);
[01:30:20]   |
[01:30:20]   |
[01:30:20]   = help: add #![feature(leading_ones_trailing_ones)] to the crate attributes to enable
[01:30:20] thread 'num/mod.rs - num::u32::leading_ones (line 45)' panicked at 'couldn't compile the test', librustdoc/test.rs:323:13
[01:30:20] 
[01:30:20] ---- num/mod.rs - num::u32::trailing_ones (line 46) stdout ----
[01:30:20] error[E0658]: use of unstable library feature 'leading_ones_trailing_ones'
[01:30:20] error[E0658]: use of unstable library feature 'leading_ones_trailing_ones'
[01:30:20]  --> num/mod.rs:49:14
[01:30:20]   |
[01:30:20] 6 | assert_eq!(n.trailing_ones(), 2);
[01:30:20]   |
[01:30:20]   |
[01:30:20]   = help: add #![feature(leading_ones_trailing_ones)] to the crate attributes to enable
[01:30:20] thread 'num/mod.rs - num::u32::trailing_ones (line 46)' panicked at 'couldn't compile the test', librustdoc/test.rs:323:13
[01:30:20] 
[01:30:20] ---- num/mod.rs - num::u64::leading_ones (line 45) stdout ----
[01:30:20] error[E0658]: use of unstable library feature 'leading_ones_trailing_ones'
[01:30:20] error[E0658]: use of unstable library feature 'leading_ones_trailing_ones'
[01:30:20]  --> num/mod.rs:48:14
[01:30:20]   |
[01:30:20] 6 | assert_eq!(n.leading_ones(), 2);
[01:30:20]   |
[01:30:20]   |
[01:30:20]   = help: add #![feature(leading_ones_trailing_ones)] to the crate attributes to enable
[01:30:20] thread 'num/mod.rs - num::u64::leading_ones (line 45)' panicked at 'couldn't compile the test', librustdoc/test.rs:323:13
[01:30:20] 
[01:30:20] ---- num/mod.rs - num::u64::trailing_ones (line 46) stdout ----
[01:30:20] error[E0658]: use of unstable library feature 'leading_ones_trailing_ones'
[01:30:20] error[E0658]: use of unstable library feature 'leading_ones_trailing_ones'
[01:30:20]  --> num/mod.rs:49:14
[01:30:20]   |
[01:30:20] 6 | assert_eq!(n.trailing_ones(), 2);
[01:30:20]   |
[01:30:20]   |
[01:30:20]   = help: add #![feature(leading_ones_trailing_ones)] to the crate attributes to enable
[01:30:20] thread 'num/mod.rs - num::u64::trailing_ones (line 46)' panicked at 'couldn't compile the test', librustdoc/test.rs:323:13
[01:30:20] 
[01:30:20] ---- num/mod.rs - num::u8::leading_ones (line 45) stdout ----
[01:30:20] error[E0658]: use of unstable library feature 'leading_ones_trailing_ones'
[01:30:20] error[E0658]: use of unstable library feature 'leading_ones_trailing_ones'
[01:30:20]  --> num/mod.rs:48:14
[01:30:20]   |
[01:30:20] 6 | assert_eq!(n.leading_ones(), 2);
[01:30:20]   |
[01:30:20]   |
[01:30:20]   = help: add #![feature(leading_ones_trailing_ones)] to the crate attributes to enable
[01:30:20] thread 'num/mod.rs - num::u8::leading_ones (line 45)' panicked at 'couldn't compile the test', librustdoc/test.rs:323:13
[01:30:20] 
[01:30:20] ---- num/mod.rs - num::u8::trailing_ones (line 46) stdout ----
[01:30:20] error[E0658]: use of unstable library feature 'leading_ones_trailing_ones'
[01:30:20] error[E0658]: use of unstable library feature 'leading_ones_trailing_ones'
[01:30:20]  --> num/mod.rs:49:14
[01:30:20]   |
[01:30:20] 6 | assert_eq!(n.trailing_ones(), 2);
[01:30:20]   |
[01:30:20]   |
[01:30:20]   = help: add #![feature(leading_ones_trailing_ones)] to the crate attributes to enable
[01:30:20] thread 'num/mod.rs - num::u8::trailing_ones (line 46)' panicked at 'couldn't compile the test', librustdoc/test.rs:323:13
[01:30:20] 
[01:30:20] ---- num/mod.rs - num::usize::leading_ones (line 45) stdout ----
[01:30:20] error[E0658]: use of unstable library feature 'leading_ones_trailing_ones'
[01:30:20] error[E0658]: use of unstable library feature 'leading_ones_trailing_ones'
[01:30:20]  --> num/mod.rs:48:14
[01:30:20]   |
[01:30:20] 6 | assert_eq!(n.leading_ones(), 2);
[01:30:20]   |
[01:30:20]   |
[01:30:20]   = help: add #![feature(leading_ones_trailing_ones)] to the crate attributes to enable
[01:30:20] thread 'num/mod.rs - num::usize::leading_ones (line 45)' panicked at 'couldn't compile the test', librustdoc/test.rs:323:13
[01:30:20] 
[01:30:20] ---- num/mod.rs - num::usize::trailing_ones (line 46) stdout ----
[01:30:20] error[E0658]: use of unstable library feature 'leading_ones_trailing_ones'
[01:30:20] error[E0658]: use of unstable library feature 'leading_ones_trailing_ones'
[01:30:20]  --> num/mod.rs:49:14
[01:30:20]   |
[01:30:20] 6 | assert_eq!(n.trailing_ones(), 2);
[01:30:20]   |
[01:30:20]   |
[01:30:20]   = help: add #![feature(leading_ones_trailing_ones)] to the crate attributes to enable
[01:30:20] thread 'num/mod.rs - num::usize::trailing_ones (line 46)' panicked at 'couldn't compile the test', librustdoc/test.rs:323:13
[01:30:20] 
[01:30:20] 
[01:30:20] failures:
---
[01:30:20] 
[01:30:20] error: test failed, to rerun pass '--doc'
[01:30:20] 
[01:30:20] 
[01:30:20] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "test" "--target" "x86_64-unknown-linux-gnu" "-j" "4" "--release" "--locked" "--color" "always" "--features" "panic-unwind backtrace" "--manifest-path" "/checkout/src/libstd/Cargo.toml" "-p" "core" "--" "--quiet"
[01:30:20] 
[01:30:20] 
[01:30:20] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[01:30:20] Build completed unsuccessfully in 0:38:59
[01:30:20] Build completed unsuccessfully in 0:38:59
[01:30:20] make: *** [check] Error 1
[01:30:20] Makefile:58: recipe for target 'check' failed

The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:055fe321
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
---
travis_time:end:04fa4b4c:start=1541516273128371973,finish=1541516273132975233,duration=4603260
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:12bcc87c
$ ln -s . checkout && for CORE in obj/cores/core.*; do EXE=$(echo $CORE | sed 's|obj/cores/core\.[0-9]*\.!checkout!\(.*\)|\1|;y|!|/|'); if [ -f "$EXE" ]; then printf travis_fold":start:crashlog\n\033[31;1m%s\033[0m\n" "$CORE"; gdb --batch -q -c "$CORE" "$EXE" -iex 'set auto-load off' -iex 'dir src/' -iex 'set sysroot .' -ex bt -ex q; echo travis_fold":"end:crashlog; fi; done || true
travis_fold:end:after_failure.4
travis_fold:start:after_failure.5
travis_time:start:10dae0d0
travis_time:start:10dae0d0
$ cat ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers || true
cat: ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers: No such file or directory
travis_fold:end:after_failure.5
travis_fold:start:after_failure.6
travis_time:start:1d1a7b8d
$ dmesg | grep -i kill

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)

```
", $Feature, "let n = 0b10110011", stringify!($SelfT), ";

assert_eq!(n.leading_ones(), 1);",
Copy link
Member

@scottmcm scottmcm Nov 6, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this will pass -- this will have no leading ones for any type size but u8.

Basic usage:

```
", $Feature, "let n = 0b10110011", stringify!($SelfT), ";
Copy link
Member

@scottmcm scottmcm Nov 6, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tidy is saying that you need #![feature(leading_ones_trailing_ones)] in the doctests.

@kennytm kennytm added the T-libs-api label Nov 14, 2018
@XAMPPRocky XAMPPRocky added S-waiting-on-author and removed S-waiting-on-review labels Nov 25, 2018
@XAMPPRocky
Copy link
Member

@XAMPPRocky XAMPPRocky commented Nov 25, 2018

Triage; @yoshuawuyts Hello, have you been able to get back this PR?

@yoshuawuyts
Copy link
Member Author

@yoshuawuyts yoshuawuyts commented Nov 27, 2018

@Aaronepower Thanks for reaching out! Ooph, no -- I've been super busy, and about to go on holiday. If it's not too much trouble, I'd love to keep this open for a few more weeks so I can hack on it once I'm back.

@TimNN TimNN added A-allocators and removed A-allocators labels Dec 4, 2018
@Dylan-DPC-zz
Copy link

@Dylan-DPC-zz Dylan-DPC-zz commented Jan 7, 2019

ping from triage @yoshuawuyts any updates on this?

@yoshuawuyts
Copy link
Member Author

@yoshuawuyts yoshuawuyts commented Jan 8, 2019

@Dylan-DPC not yet; haven't forgotten about it! -- I'm planning to tackle this next week! 🎉

@TimNN
Copy link
Contributor

@TimNN TimNN commented Jan 22, 2019

Ping from triage @yoshuawuyts: What is the status of this PR?

$EndFeature, "
```"),
#[unstable(feature = "leading_ones_trailing_ones", issue = "0")]
#[rustc_const_unstable(feature = "const_int_ops")]
Copy link
Contributor

@Centril Centril Jan 27, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd just remove this; I think it's fairly certain that we'll want it to be const fn when stabilizing.

$EndFeature, "
```"),
#[unstable(feature = "leading_ones_trailing_ones", issue = "0")]
#[rustc_const_unstable(feature = "const_int_ops")]
Copy link
Contributor

@Centril Centril Jan 27, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same, I'd remove this line.

assert_eq!(n.leading_ones(), 2);", $EndFeature, "
```"),
#[unstable(feature = "leading_ones_trailing_ones", issue = "0")]
#[rustc_const_unstable(feature = "const_int_ops")]
Copy link
Contributor

@Centril Centril Jan 27, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and here...

assert_eq!(n.trailing_ones(), 2);", $EndFeature, "
```"),
#[unstable(feature = "leading_ones_trailing_ones", issue = "0")]
#[rustc_const_unstable(feature = "const_int_ops")]
Copy link
Contributor

@Centril Centril Jan 27, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and here.

@yoshuawuyts
Copy link
Member Author

@yoshuawuyts yoshuawuyts commented Jan 29, 2019

Update: I've spent some time building this out again yesterday, but ran into build problems with Rust itself. Sorry this is taking a while!

@yoshuawuyts
Copy link
Member Author

@yoshuawuyts yoshuawuyts commented Jan 29, 2019

Created an issue for this PR in #57969. If someone else would like to carry this PR over the finish line that'd be grand! -- I feel we're really close; it just requires passing lints + feature labels.

@Dylan-DPC-zz
Copy link

@Dylan-DPC-zz Dylan-DPC-zz commented Feb 25, 2019

ping from triage @yoshuawuyts closing this due to inactivity and since you are not planning of taking this forward. Thanks!

@Dylan-DPC-zz Dylan-DPC-zz added S-inactive and removed S-waiting-on-author labels Feb 25, 2019
@yoshuawuyts yoshuawuyts deleted the trailing_ones_trailing_zeros branch Feb 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-inactive T-libs-api
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

10 participants