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 DoubleEndedIterator::nth_back #56802

Merged
merged 1 commit into from
Dec 23, 2018
Merged

Conversation

clarfonthey
Copy link
Contributor

@clarfonthey clarfonthey commented Dec 14, 2018

As suggested by #54054. This doesn't fix that issue, as this doesn't add enough implementations to optimise that specific use case, but it adds the method and a few (relatively) trivial overrides to work as an initial implementation.

It's probably going to be a lot of work adding nth_back implementations everywhere, and I don't have the time to include it all in this commit. But, it's a start. :)

@rust-highfive
Copy link
Collaborator

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:097988b8:start=1544761815736919259,finish=1544761816720112919,duration=983193660
$ 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:03:25]    Compiling cc v1.0.25
[00:03:25]    Compiling libc v0.2.45
[00:03:25]    Compiling core v0.0.0 (/checkout/src/libcore)
[00:03:25]    Compiling build_helper v0.1.0 (/checkout/src/build_helper)
[00:03:25] error: incorrect close delimiter: `]`
[00:03:25]     |
[00:03:25]     |
[00:03:25] 472 |     #[unstable(feature = "iter_nth_back", issue = "54054"]
[00:03:25]     |      -        - un-closed delimiter                      ^ incorrect close delimiter
[00:03:25]     |      |
[00:03:25]     |      close delimiter possibly meant for this
[00:03:28]    Compiling unwind v0.0.0 (/checkout/src/libunwind)
[00:03:32]    Compiling compiler_builtins v0.1.2
[00:03:32]    Compiling cmake v0.1.33
[00:03:32]    Compiling std v0.0.0 (/checkout/src/libstd)
[00:03:32]    Compiling std v0.0.0 (/checkout/src/libstd)
[00:03:35]    Compiling rustc_msan v0.0.0 (/checkout/src/librustc_msan)
[00:03:35]    Compiling rustc_lsan v0.0.0 (/checkout/src/librustc_lsan)
[00:03:36]    Compiling rustc_tsan v0.0.0 (/checkout/src/librustc_tsan)
[00:03:36]    Compiling rustc_asan v0.0.0 (/checkout/src/librustc_asan)
[00:03:41]    --> src/libcore/iter/traits.rs:673:18
[00:03:41]     |
[00:03:41] 673 |         (**self).rfind(predicate)
[00:03:41]     |
[00:03:41]     = help: the trait `marker::Sized` is not implemented for `I`
[00:03:41]     = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
[00:03:41]     = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
[00:03:41]     = help: consider adding a `where I: marker::Sized` bound
eGen/X86
40496 ./src/llvm-emscripten/lib/Target
37776 ./src/tools/lldb/www
37208 ./obj/build/x86_64-unknown-linux-gnu/stage0-std
---
travis_time:end:027e6838:start=1544762051466147273,finish=1544762051471372398,duration=5225125
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:0e960bf0
$ 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:07229744
travis_time:start:07229744
$ 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:07eb5eb1
$ 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)

src/libcore/iter/mod.rs Outdated Show resolved Hide resolved
src/libcore/iter/mod.rs Outdated Show resolved Hide resolved
src/libcore/iter/traits.rs Outdated Show resolved Hide resolved
src/libcore/iter/traits.rs Outdated Show resolved Hide resolved
src/libcore/iter/traits.rs Outdated Show resolved Hide resolved
src/libcore/iter/traits.rs Outdated Show resolved Hide resolved
src/libcore/iter/traits.rs Outdated Show resolved Hide resolved
@cuviper cuviper added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Dec 14, 2018
@cuviper
Copy link
Member

cuviper commented Dec 14, 2018

It seems the bot missed this PR to assign a reviewer, so I'll try:

r? @alexcrichton

@clarfonthey
Copy link
Contributor Author

I'm going to add individual commits as I'm fixing things but once everything is done I'll squash the commits.

@rust-highfive
Copy link
Collaborator

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:0390ddb0:start=1544896510412256371,finish=1544896567684699299,duration=57272442928
$ 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

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)

@rust-highfive
Copy link
Collaborator

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:0be1858c:start=1544996170541545844,finish=1544996235516828042,duration=64975282198
$ 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
---
travis_time:start:test_codegen
Check compiletest suite=codegen mode=codegen (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[00:52:31] 
[00:52:31] running 121 tests
[00:52:34] i..ii...iii..iiii.....i...i..........i..iii.............i.....i......ii...i..i.ii..............i...i 100/121
[00:52:34] i..ii.i.....iiii.....
[00:52:34] 
[00:52:34]  finished in 3.609
[00:52:34] 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)
[00:52:49] 
[00:52:49] running 119 tests
[00:53:11] .iiiii...i.....i..i...i..i.i..i.ii..i.....i..i....i..........iiii.........i.i...ii...i.......ii.i.i. 100/119
[00:53:15] i......iii.i.....ii
[00:53:15] 
[00:53:15]  finished in 26.396
[00:53:15] travis_fold:end:test_debuginfo

---
[01:04:36] running 2213 tests
[01:04:46] .................................................................................................... 100/2213
[01:04:56] .................................................................................................... 200/2213
[01:05:08] .................................................................................................... 300/2213
[01:05:20] ..............................................i........................FFF.......................... 400/2213
[01:05:40] .................................................................................................... 600/2213
[01:05:50] .................................................................................................... 700/2213
[01:06:01] .................................................................................................... 800/2213
[01:06:11] .................................................................................................... 900/2213

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)

src/libcore/iter/mod.rs Outdated Show resolved Hide resolved
@alexcrichton
Copy link
Member

Thanks for the PR! Would it be possible to add nth_back first before adding the specialized implementations? The tests look quite light here and we've been bitten in the past with incorrect specializations, so it'd be great if the specializations could be reviewed and tested with more scrutiny separately

@clarfonthey
Copy link
Contributor Author

Yeah, I definitely shouldn't have included those if I don't have the time to test them. I've removed them and also updated the documentation for nth_back, and things should compile now. The only specialisation I left in was the one for Rev which was mostly the entire point, and it's so trivial that it doesn't really need any tests.

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-6.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:1bd9e0ac:start=1545083970361818685,finish=1545084059795746139,duration=89433927454
$ 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-6.0
---
[00:48:02]     Checking core v0.0.0 (/checkout/src/libcore)
[00:48:33]     Checking rustc-std-workspace-core v1.0.0 (/checkout/src/tools/rustc-std-workspace-core)
[00:48:33]     Checking compiler_builtins v0.1.2
[00:48:34]  Documenting alloc v0.0.0 (/checkout/src/liballoc)
[00:48:38] warning: `[Iterator::nth]` cannot be resolved, ignoring it...
[00:48:38]     |
[00:48:38]     |
[00:48:38] 432 |     /// This is essentially the reversed version of [`nth`][Iterator::nth]. Although
[00:48:38]     |
[00:48:38]     = note: #[warn(intra_doc_link_resolution_failure)] on by default
[00:48:38]     = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
[00:48:38] 
[00:48:38] 
[00:48:38] warning: `[Iterator::nth]` cannot be resolved, ignoring it...
[00:48:38]     |
[00:48:38]     |
[00:48:38] 432 |     /// This is essentially the reversed version of [`nth`][Iterator::nth]. Although
[00:48:38]     |
[00:48:38]     = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
[00:48:38] 
[00:48:39]     Finished release [optimized] target(s) in 37.61s
---
[00:49:14]     |              ^^^^^^^^^^^^^^^ cannot be resolved, ignoring
[00:49:14]     |
[00:49:14]     = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
[00:49:14] 
[00:49:14] warning: `[Iterator::nth]` cannot be resolved, ignoring it...
[00:49:14]     |
[00:49:14]     |
[00:49:14] 432 |     /// This is essentially the reversed version of [`nth`][Iterator::nth]. Although
[00:49:14]     |
[00:49:14]     = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
[00:49:14] 
[00:49:19]     Finished release [optimized] target(s) in 18.45s
[00:49:19]     Finished release [optimized] target(s) in 18.45s
[00:49:19] Documenting stage2 test (x86_64-unknown-linux-gnu)
[00:49:20]     Checking proc_macro v0.0.0 (/checkout/src/libproc_macro)
[00:49:20]     Checking term v0.0.0 (/checkout/src/libterm)
[00:49:20]     Checking getopts v0.2.17
[00:49:24]  Documenting test v0.0.0 (/checkout/src/libtest)
[00:49:26] warning: `[Iterator::nth]` cannot be resolved, ignoring it...
[00:49:26]     |
[00:49:26]     |
[00:49:26] 432 |     /// This is essentially the reversed version of [`nth`][Iterator::nth]. Although
[00:49:26]     |
[00:49:26]     = note: #[warn(intra_doc_link_resolution_failure)] on by default
[00:49:26]     = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
[00:49:26] 
[00:49:26] 
[00:49:26] warning: `[Iterator::nth]` cannot be resolved, ignoring it...
[00:49:26]     |
[00:49:26]     |
[00:49:26] 432 |     /// This is essentially the reversed version of [`nth`][Iterator::nth]. Although
[00:49:26]     |
[00:49:26]     = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
[00:49:26] 
[00:49:26]     Finished release [optimized] target(s) in 6.53s
[00:49:26]     Finished release [optimized] target(s) in 6.53s
[00:49:26] Documenting stage2 whitelisted compiler (x86_64-unknown-linux-gnu)
[00:49:27]  Documenting proc_macro v0.0.0 (/checkout/src/libproc_macro)
[00:49:30] warning: `[Iterator::nth]` cannot be resolved, ignoring it...
[00:49:30]     |
[00:49:30]     |
[00:49:30] 432 |     /// This is essentially the reversed version of [`nth`][Iterator::nth]. Although
[00:49:30]     |
[00:49:30]     = note: #[warn(intra_doc_link_resolution_failure)] on by default
[00:49:30]     = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
[00:49:30] 
[00:49:30] 
[00:49:30] warning: `[Iterator::nth]` cannot be resolved, ignoring it...
[00:49:30]     |
[00:49:30]     |
[00:49:30] 432 |     /// This is essentially the reversed version of [`nth`][Iterator::nth]. Although
[00:49:30]     |
[00:49:30]     = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
[00:49:30] 
[00:49:30]     Finished release [optimized] target(s) in 3.65s
---
travis_time:start:test_debuginfo
Check compiletest suite=debuginfo mode=debuginfo-both (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[01:01:17] 
[01:01:17] running 119 tests
[01:01:40] .iiiii...i.....i..i...i..i.i..i.ii..i.....i..i....i..........iiii.........i.i...ii...i.......ii.i.i. 100/119
[01:01:44] i......iii.i.....ii
[01:01:44] 
[01:01:44]  finished in 27.022
[01:01:44] travis_fold:end:test_debuginfo

---
travis_time:start:test_rustdoc
Check compiletest suite=rustdoc mode=rustdoc (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[01:07:19] 
[01:07:19] running 282 tests
[01:08:33] ........................i....................................................................FFF.... 100/282
[01:10:30] ..................................................................................
[01:10:30] failures:
[01:10:30] 
[01:10:30] ---- [rustdoc] rustdoc/intra-link-extern-crate.rs stdout ----
---
[01:10:30] 
[01:10:30] ------------------------------------------
[01:10:30] stderr:
[01:10:30] ------------------------------------------
[01:10:30] error: `[Iterator::nth]` cannot be resolved, ignoring it...
[01:10:30]     |
[01:10:30]     |
[01:10:30] 432 |     /// This is essentially the reversed version of [`nth`][Iterator::nth]. Although
[01:10:30]     |
[01:10:30] note: lint level defined here
[01:10:30]    --> /checkout/src/test/rustdoc/intra-link-extern-crate.rs:17:9
[01:10:30]     |
[01:10:30]     |
[01:10:30] 17  | #![deny(intra_doc_link_resolution_failure)]
[01:10:30]     |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[01:10:30]     = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
[01:10:30] 
[01:10:30] error: `[Iterator::nth]` cannot be resolved, ignoring it...
[01:10:30]     |
[01:10:30]     |
[01:10:30] 432 |     /// This is essentially the reversed version of [`nth`][Iterator::nth]. Although
[01:10:30]     |
[01:10:30]     = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
[01:10:30] 
[01:10:30] 
---
[01:10:30] ---- [rustdoc] rustdoc/intra-link-in-bodies.rs stdout ----
[01:10:30] 
[01:10:30] error: rustdoc failed!
[01:10:30] status: exit code: 1
[01:10:30] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustdoc" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/rustdoc/intra-link-in-bodies/auxiliary" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/rustdoc/intra-link-in-bodies" "/checkout/src/test/rustdoc/intra-link-in-bodies.rs"
[01:10:30] ------------------------------------------
[01:10:30] 
[01:10:30] ------------------------------------------
[01:10:30] stderr:
[01:10:30] stderr:
[01:10:30] ------------------------------------------
[01:10:30] error: `[Iterator::nth]` cannot be resolved, ignoring it...
[01:10:30]     |
[01:10:30]     |
[01:10:30] 432 |     /// This is essentially the reversed version of [`nth`][Iterator::nth]. Although
[01:10:30]     |
[01:10:30] note: lint level defined here
[01:10:30]    --> /checkout/src/test/rustdoc/intra-link-in-bodies.rs:13:9
[01:10:30]     |
[01:10:30]     |
[01:10:30] 13  | #![deny(intra_doc_link_resolution_failure)]
[01:10:30]     |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[01:10:30]     = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
[01:10:30] 
[01:10:30] error: `[Iterator::nth]` cannot be resolved, ignoring it...
[01:10:30]     |
[01:10:30]     |
[01:10:30] 432 |     /// This is essentially the reversed version of [`nth`][Iterator::nth]. Although
[01:10:30]     |
[01:10:30]     = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
[01:10:30] 
[01:10:30] 
---
[01:10:30] ---- [rustdoc] rustdoc/intra-link-private.rs stdout ----
[01:10:30] 
[01:10:30] error: rustdoc failed!
[01:10:30] status: exit code: 1
[01:10:30] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustdoc" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/rustdoc/intra-link-private/auxiliary" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/rustdoc/intra-link-private" "/checkout/src/test/rustdoc/intra-link-private.rs"
[01:10:30] ------------------------------------------
[01:10:30] 
[01:10:30] ------------------------------------------
[01:10:30] stderr:
[01:10:30] stderr:
[01:10:30] ------------------------------------------
[01:10:30] error: `[Iterator::nth]` cannot be resolved, ignoring it...
[01:10:30]     |
[01:10:30]     |
[01:10:30] 432 |     /// This is essentially the reversed version of [`nth`][Iterator::nth]. Although
[01:10:30]     |
[01:10:30] note: lint level defined here
[01:10:30]    --> /checkout/src/test/rustdoc/intra-link-private.rs:15:9
[01:10:30]     |
[01:10:30]     |
[01:10:30] 15  | #![deny(intra_doc_link_resolution_failure)]
[01:10:30]     |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[01:10:30]     = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
[01:10:30] 
[01:10:30] error: `[Iterator::nth]` cannot be resolved, ignoring it...
[01:10:30]     |
[01:10:30]     |
[01:10:30] 432 |     /// This is essentially the reversed version of [`nth`][Iterator::nth]. Although
[01:10:30]     |
[01:10:30]     = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
[01:10:30] 
[01:10:30] 
---
[01:10:30] 
[01:10:30] test result: FAILED. 277 passed; 3 failed; 2 ignored; 0 measured; 0 filtered out
[01:10/bootstrap test
[01:10:30] Build completed unsuccessfully in 0:20:52
[01:10:30] make: *** [check] Error 1
[01:10:30] Makefile:58: recipe for target 'check' failed
The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:159ec8ac
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
Mon Dec 17 23:11:41 UTC 2018
---
183740 ./obj/build/x86_64-unknown-linux-gnu/test/ui
160388 ./obj/build/bootstrap/debug/incremental
153272 ./src/tools/clang
144288 ./obj/build/bootstrap/debug/incremental/bootstrap-2x7szixskz2uj
144284 ./obj/build/bootstrap/debug/incremental/bootstrap-2x7szixskz2uj/s-f7opx26amb-fdngv1-2sxk29axi4qzn
137420 ./obj/build/x86_64-unknown-linux-gnu/stage1-rustc
128696 ./obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu
128692 ./obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release
126304 ./obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps

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)

@clarfonthey clarfonthey force-pushed the nth_back branch 2 times, most recently from 54f1fd4 to 9fd51a7 Compare December 17, 2018 23:18
@clarfonthey
Copy link
Contributor Author

(Build is finally passing and ready for review.)

@alexcrichton
Copy link
Member

Looking good! Can some more exhaustive tests be added as well beyond the documentation? Additionally could tests for DoubleEndedIterator::nth be added or ensure they exist? (as it's now specialized to nth_back)

@alexcrichton
Copy link
Member

Oh and also, some tests of DoubleEndedIterator::nth would be good to have as well

@bluss
Copy link
Member

bluss commented Dec 18, 2018

Do you think we can find a better place for src/libcore/iter_private.rs too? Should be easy with pub(crate) features. Edit: Oh, this comment is on the wrong PR. Engaging teleporters..

@clarfonthey
Copy link
Contributor Author

@alexcrichton I assume you meant Rev?

@alexcrichton
Copy link
Member

Oops, yes indeed!

@clarfonthey clarfonthey force-pushed the nth_back branch 2 times, most recently from a5e36e9 to f182145 Compare December 19, 2018 21:14
@clarfonthey
Copy link
Contributor Author

clarfonthey commented Dec 19, 2018

Tests should be good now! And I made a tracking issue.

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-6.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:0147c006:start=1545254357811000030,finish=1545254358852659705,duration=1041659675
$ 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-6.0
---
travis_time:start:test_debuginfo
Check compiletest suite=debuginfo mode=debuginfo-both (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[00:55:15] 
[00:55:15] running 119 tests
[00:55:38] .iiiii...i.....i..i...i..i.i..i.ii..i.....i..i....i..........iiii.........i.i...ii...i.......ii.i.i. 100/119
[00:55:42] i......iii.i.....ii
[00:55:42] 
[00:55:42]  finished in 27.317
[00:55:42] travis_fold:end:test_debuginfo

---
[01:06:20] travis_fold:start:test_stage1-core
travis_time:start:test_stage1-core
Testing core stage1 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[01:06:21]    Compiling core v0.0.0 (/checkout/src/libcore)
[01:06:28] error[E0658]: use of unstable library feature 'iter_nth_back' (see issue #56995)
[01:06:28]      |
[01:06:28]      |
[01:06:28] 1023 |         assert_eq!(v.iter().nth_back(i).unwrap(), &v[v.len() - 1 - i]);
[01:06:28]      |
[01:06:28]      = help: add #![feature(iter_nth_back)] to the crate attributes to enable
[01:06:28] 
[01:06:28] 
[01:06:28] error[E0658]: use of unstable library feature 'iter_nth_back' (see issue #56995)
[01:06:28]      |
[01:06:28]      |
[01:06:28] 1025 |     assert_eq!(v.iter().nth_back(v.len()), None);
[01:06:28]      |
[01:06:28]      = help: add #![feature(iter_nth_back)] to the crate attributes to enable
[01:06:28] 
[01:06:28] 
[01:06:28] error[E0658]: use of unstable library feature 'iter_nth_back' (see issue #56995)
[01:06:28]      |
[01:06:28]      |
[01:06:28] 1032 |         assert_eq!(v.iter().nth_back(i).unwrap(), &v[i]);
[01:06:28]      |
[01:06:28]      = help: add #![feature(iter_nth_back)] to the crate attributes to enable
[01:06:28] 
[01:06:28] 
[01:06:28] error[E0658]: use of unstable library feature 'iter_nth_back' (see issue #56995)
[01:06:28]      |
[01:06:28]      |
[01:06:28] 1034 |     assert_eq!(v.iter().nth_back(v.len()), None);
[01:06:28]      |
[01:06:28]      = help: add #![feature(iter_nth_back)] to the crate attributes to enable
[01:06:28] 
[01:06:36] error: aborting due to 4 previous errors
[01:06:36] error: aborting due to 4 previous errors
[01:06:36] 
[01:06:36] For more information about this error, try `rustc --explain E0658`.
[01:06:36] error: Could not compile `core`.
[01:06:36] 
[01:06:36] To learn more, run the command again with --verbose.
[01:06:36] 
[01:06:36] 
[01:06:36] 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:06:36] 
[01:06:36] 
[01:06:36] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[01:06:36] Build completed unsuccessfully in 0:22:29
[01:06:36] Build completed unsuccessfully in 0:22:29
[01:06:36] Makefile:58: recipe for target 'check' failed
[01:06:36] make: *** [check] Error 1
The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:25bcb77a
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
Wed Dec 19 22:26:04 UTC 2018
---
travis_time:end:135543d1:start=1545258365786445655,finish=1545258365795029893,duration=8584238
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:0ffd4fa3
$ 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 "$EX

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)

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-6.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:168c05d0:start=1545258900620362070,finish=1545258902133977977,duration=1513615907
$ 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-6.0
---
travis_time:start:test_debuginfo
Check compiletest suite=debuginfo mode=debuginfo-both (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[00:58:18] 
[00:58:18] running 119 tests
[00:58:41] .iiiii...i.....i..i...i..i.i..i.ii..i.....i..i....i..........iiii.........i.i...ii...i.......ii.i.i. 100/119
[00:58:45] i......iii.i.....ii
[00:58:45] 
[00:58:45]  finished in 27.123
[00:58:45] travis_fold:end:test_debuginfo

---
[01:10:01] travis_fold:start:test_stage1-core
travis_time:start:test_stage1-core
Testing core stage1 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[01:10:01]    Compiling core v0.0.0 (/checkout/src/libcore)
[01:10:08] error[E0658]: use of unstable library feature 'iter_nth_back' (see issue #56995)
[01:10:08]      |
[01:10:08]      |
[01:10:08] 1023 |         assert_eq!(v.iter().nth_back(i).unwrap(), &v[v.len() - 1 - i]);
[01:10:08]      |
[01:10:08]      = help: add #![feature(iter_nth_back)] to the crate attributes to enable
[01:10:08] 
[01:10:08] 
[01:10:08] error[E0658]: use of unstable library feature 'iter_nth_back' (see issue #56995)
[01:10:08]      |
[01:10:08]      |
[01:10:08] 1025 |     assert_eq!(v.iter().nth_back(v.len()), None);
[01:10:08]      |
[01:10:08]      = help: add #![feature(iter_nth_back)] to the crate attributes to enable
[01:10:08] 
[01:10:08] 
[01:10:08] error[E0658]: use of unstable library feature 'iter_nth_back' (see issue #56995)
[01:10:08]      |
[01:10:08]      |
[01:10:08] 1032 |         assert_eq!(v.iter().nth_back(i).unwrap(), &v[i]);
[01:10:08]      |
[01:10:08]      = help: add #![feature(iter_nth_back)] to the crate attributes to enable
[01:10:08] 
[01:10:08] 
[01:10:08] error[E0658]: use of unstable library feature 'iter_nth_back' (see issue #56995)
[01:10:08]      |
[01:10:08]      |
[01:10:08] 1034 |     assert_eq!(v.iter().nth_back(v.len()), None);
[01:10:08]      |
[01:10:08]      = help: add #![feature(iter_nth_back)] to the crate attributes to enable
[01:10:08] 
Wed, 19 Dec 2018 23:45:26 GMT
---
travis_time:end:001bc4e3:start=1545263128121983093,finish=1545263128129852949,duration=7869856
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:02e725ba
$ 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 "$EX

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)

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-6.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:0eeb761c:start=1545275892308755942,finish=1545275947775039463,duration=55466283521
$ 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-6.0
---
    100% |████████████████████████████████| 51kB 10.7MB/s 
Collecting botocore==1.12.69 (from awscli)
/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
  Downloading https://files.pythonhosted.org/packages/72/ba/a188505f67a78a686aa24d8511a18cb5a8bb27705c9d1b1bb81bee97a138/botocore-1.12.69-py2.py3-none-any.whl (5.2MB)
    0% |                                | 10kB 35.6MB/s eta 0:00:01
    0% |▏                               | 20kB 36.8MB/s eta 0:00:01
    0% |▏                               | 30kB 42.4MB/s eta 0:00:01
    0% |▎                               | 40kB 46.4MB/s eta 0:00:01
---
travis_time:start:test_debuginfo
Check compiletest suite=debuginfo mode=debuginfo-both (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[01:05:33] 
[01:05:33] running 119 tests
[01:05:56] .iiiii...i.....i..i...i..i.i..i.ii..i.....i..i....i..........iiii.........i.i...ii...i.......ii.i.i. 100/119
[01:05:59] i......iii.i.....ii
[01:05:59] 
[01:05:59]  finished in 26.055
[01:05:59] travis_fold:end:test_debuginfo

---
[01:17:18] .................................................................................................... 900/916
[01:17:19] ................
[01:17:19] failures:
[01:17:19] 
[01:17:19] ---- iter::test_iterator_rev_nth_back stdout ----
[01:17:19] thread 'iter::test_iterator_rev_nth_back' panicked at 'assertion failed: `(left == right)`
[01:17:19]  right: `0`', src/libcore/../libcore/tests/iter.rs:1032:9
[01:17:19] 
[01:17:19] 
[01:17:19] failures:
[01:17:19] failures:
[01:17:19]     iter::test_iterator_rev_nth_back
[01:17:19] 
[01:17:19] test result: FAILED. 913 passed; 1 failed; 2 ignored; 0 measured; 0 filtered out
[01:17:19] 
[01:17:19] error: test failed, to rerun pass '--test coretests'
[01:17:19] 
[01:17:19] 
[01:17:19] 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:17:19] 
[01:17:19] 
[01:17:19] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[01:17:19] Build completed unsuccessfully in 0:22:17
[01:17:19] Build completed unsuccessfully in 0:22:17
[01:17:19] Makefile:58: recipe for target 'check' failed
[01:17:19] make: *** [check] Error 1
The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:25c5d42c
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
Thu Dec 20 04:36:35 UTC 2018

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)

@clarfonthey
Copy link
Contributor Author

Note: Tests work best when they're testing what you actually wanted to test. They work, now. 😅

@alexcrichton
Copy link
Member

@bors: r+

@bors
Copy link
Contributor

bors commented Dec 20, 2018

📌 Commit fb18dda has been approved by alexcrichton

@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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Dec 20, 2018
@alexcrichton
Copy link
Member

@bors: rollup

Mark-Simulacrum added a commit to Mark-Simulacrum/rust that referenced this pull request Dec 21, 2018
Add DoubleEndedIterator::nth_back

As suggested by rust-lang#54054. This doesn't fix that issue, as this doesn't add enough implementations to optimise that specific use case, but it adds the method and a few (relatively) trivial overrides to work as an initial implementation.

It's probably going to be a lot of work adding `nth_back` implementations everywhere, and I don't have the time to include it all in this commit. But, it's a start. :)
pietroalbini added a commit to pietroalbini/rust that referenced this pull request Dec 21, 2018
Add DoubleEndedIterator::nth_back

As suggested by rust-lang#54054. This doesn't fix that issue, as this doesn't add enough implementations to optimise that specific use case, but it adds the method and a few (relatively) trivial overrides to work as an initial implementation.

It's probably going to be a lot of work adding `nth_back` implementations everywhere, and I don't have the time to include it all in this commit. But, it's a start. :)
bors added a commit that referenced this pull request Dec 21, 2018
Rollup of 20 pull requests

Successful merges:

 - #56802 (Add DoubleEndedIterator::nth_back)
 - #56842 (Add unstable VecDeque::rotate_{left|right})
 - #56869 (Reduce search-index.js size)
 - #56887 (Disable field reordering for repr(int).)
 - #56892 (rustc: Update Clang used to build LLVM on Linux)
 - #56909 (static eval: Do not ICE on layout size overflow)
 - #56914 (Ignore ui/target-feature-gate on sparc, sparc64, powerpc, powerpc64 and powerpc64le)
 - #56917 (Simplify MIR generation for logical operations)
 - #56919 (Remove a wrong multiplier on relocation offset computation)
 - #56933 (Add --progress to git submodule commands in x.py)
 - #56941 (deny intra-doc link resolution failures in libstd)
 - #56964 (Remove `TokenStream::JointTree`.)
 - #56970 (Mem uninit doc ptr drop)
 - #56973 (make basic CTFE tracing available on release builds)
 - #56979 (Adding unwinding support for x86_64_fortanix_unknown_sgx target.)
 - #56981 (miri: allocation is infallible)
 - #56984 (A few tweaks to dropck_outlives)
 - #56989 (Fix compiletest `trim` deprecation warnings)
 - #56992 (suggest similar lint names for unknown lints)
 - #57002 (Stabilize Vec(Deque)::resize_with)

Failed merges:

r? @ghost
bors added a commit that referenced this pull request Dec 21, 2018
Rollup of 20 pull requests

Successful merges:

 - #56802 (Add DoubleEndedIterator::nth_back)
 - #56842 (Add unstable VecDeque::rotate_{left|right})
 - #56869 (Reduce search-index.js size)
 - #56887 (Disable field reordering for repr(int).)
 - #56892 (rustc: Update Clang used to build LLVM on Linux)
 - #56909 (static eval: Do not ICE on layout size overflow)
 - #56914 (Ignore ui/target-feature-gate on sparc, sparc64, powerpc, powerpc64 and powerpc64le)
 - #56917 (Simplify MIR generation for logical operations)
 - #56919 (Remove a wrong multiplier on relocation offset computation)
 - #56933 (Add --progress to git submodule commands in x.py)
 - #56941 (deny intra-doc link resolution failures in libstd)
 - #56964 (Remove `TokenStream::JointTree`.)
 - #56970 (Mem uninit doc ptr drop)
 - #56973 (make basic CTFE tracing available on release builds)
 - #56979 (Adding unwinding support for x86_64_fortanix_unknown_sgx target.)
 - #56981 (miri: allocation is infallible)
 - #56984 (A few tweaks to dropck_outlives)
 - #56989 (Fix compiletest `trim` deprecation warnings)
 - #56992 (suggest similar lint names for unknown lints)
 - #57002 (Stabilize Vec(Deque)::resize_with)

Failed merges:

r? @ghost
Centril added a commit to Centril/rust that referenced this pull request Dec 22, 2018
Add DoubleEndedIterator::nth_back

As suggested by rust-lang#54054. This doesn't fix that issue, as this doesn't add enough implementations to optimise that specific use case, but it adds the method and a few (relatively) trivial overrides to work as an initial implementation.

It's probably going to be a lot of work adding `nth_back` implementations everywhere, and I don't have the time to include it all in this commit. But, it's a start. :)
kennytm added a commit to kennytm/rust that referenced this pull request Dec 22, 2018
Add DoubleEndedIterator::nth_back

As suggested by rust-lang#54054. This doesn't fix that issue, as this doesn't add enough implementations to optimise that specific use case, but it adds the method and a few (relatively) trivial overrides to work as an initial implementation.

It's probably going to be a lot of work adding `nth_back` implementations everywhere, and I don't have the time to include it all in this commit. But, it's a start. :)
bors added a commit that referenced this pull request Dec 22, 2018
Rollup of 25 pull requests

Successful merges:

 - #56802 (Add DoubleEndedIterator::nth_back)
 - #56909 (static eval: Do not ICE on layout size overflow)
 - #56914 (Ignore ui/target-feature-gate on sparc, sparc64, powerpc, powerpc64 and powerpc64le)
 - #56919 (Remove a wrong multiplier on relocation offset computation)
 - #56933 (Add --progress to git submodule commands in x.py)
 - #56936 (rename div_euc -> div_euclid, and mod_euc -> rem_euclid)
 - #56941 (deny intra-doc link resolution failures in libstd)
 - #56945 (Fix rustdoc-js tests)
 - #56967 (Replace current crate's searchIndex when regenerating)
 - #56970 (Mem uninit doc ptr drop)
 - #56973 (make basic CTFE tracing available on release builds)
 - #56979 (Adding unwinding support for x86_64_fortanix_unknown_sgx target.)
 - #56981 (miri: allocation is infallible)
 - #56984 (A few tweaks to dropck_outlives)
 - #56989 (Fix compiletest `trim` deprecation warnings)
 - #56992 (suggest similar lint names for unknown lints)
 - #57002 (Stabilize Vec(Deque)::resize_with)
 - #57011 (rustdoc: add new CLI flag to load static files from a different location)
 - #57027 (Optimize away a move)
 - #57034 (Inline tweaks)
 - #57039 (Update migrate warning wording.)
 - #57040 (Fix feature gate to point to 1.32.0 for `path_from_str`)
 - #57049 (Stabilize #[repr(packed(N))])
 - #57050 (Fixed typo in HashMap documentation)
 - #57052 (Fix stabilization version numbers (exhaustive_integer_patterns + macro_literal_matcher))
@bors bors merged commit fb18dda into rust-lang:master Dec 23, 2018
@clarfonthey clarfonthey deleted the nth_back branch December 23, 2018 19:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

7 participants