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

Rev::rposition counts from the wrong end #63549

Merged
merged 1 commit into from
Sep 5, 2019

Conversation

sfanxiang
Copy link
Contributor

Introduced in #43074.

cc @SimonSapin

@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 @alexcrichton (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 Aug 14, 2019
@rust-highfive
Copy link
Collaborator

The job mingw-check of your PR failed (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.
2019-08-14T10:16:25.4532991Z ##[command]git remote add origin https://github.com/rust-lang/rust
2019-08-14T10:16:25.4734541Z ##[command]git config gc.auto 0
2019-08-14T10:16:25.4819082Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2019-08-14T10:16:25.4878229Z ##[command]git config --get-all http.proxy
2019-08-14T10:16:25.5054098Z ##[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/63549/merge:refs/remotes/pull/63549/merge
---
2019-08-14T10:17:02.0725521Z do so (now or later) by using -b with the checkout command again. Example:
2019-08-14T10:17:02.0727003Z 
2019-08-14T10:17:02.0728666Z   git checkout -b <new-branch-name>
2019-08-14T10:17:02.0731864Z 
2019-08-14T10:17:02.0733164Z HEAD is now at b6d4373f6 Merge 13a9780405ca13055709f1c4b6f3f3b8ea59797e into 60960a260f7b5c695fd0717311d72ce62dd4eb43
2019-08-14T10:17:02.0885201Z ##[section]Starting: Collect CPU-usage statistics in the background
2019-08-14T10:17:02.0888167Z ==============================================================================
2019-08-14T10:17:02.0888247Z Task         : Bash
2019-08-14T10:17:02.0888315Z Description  : Run a Bash script on macOS, Linux, or Windows
---
2019-08-14T10:22:11.5997057Z    |
2019-08-14T10:22:11.5997351Z 76 | #![feature(const_generics)]
2019-08-14T10:22:11.5997636Z    |            ^^^^^^^^^^^^^^
2019-08-14T10:22:11.5997835Z 
2019-08-14T10:22:18.8894387Z error[E0277]: expected a `ops::function::FnMut<(<I as iter::traits::iterator::Iterator>::Item,)>` closure, found `P`
2019-08-14T10:22:18.8894821Z   --> src/libcore/iter/adapters/mod.rs:75:19
2019-08-14T10:22:18.8895075Z    |
2019-08-14T10:22:18.8895426Z 75 |         self.iter.position(predicate).map(|i| self.len() - i - 1)
2019-08-14T10:22:18.8895876Z    |                   ^^^^^^^^ expected an `FnMut<(<I as iter::traits::iterator::Iterator>::Item,)>` closure, found `P`
2019-08-14T10:22:18.8896236Z    |
2019-08-14T10:22:18.8896600Z    = help: the trait `ops::function::FnMut<(<I as iter::traits::iterator::Iterator>::Item,)>` is not implemented for `P`
2019-08-14T10:22:18.8896990Z    = help: consider adding a `where P: ops::function::FnMut<(<I as iter::traits::iterator::Iterator>::Item,)>` bound
2019-08-14T10:22:20.1958521Z    Compiling libc v0.2.60
2019-08-14T10:22:21.1328707Z    Compiling build_helper v0.1.0 (/checkout/src/build_helper)
2019-08-14T10:22:22.6217713Z error: aborting due to previous error
2019-08-14T10:22:22.6222163Z 
2019-08-14T10:22:22.6222163Z 
2019-08-14T10:22:22.6228698Z For more information about this error, try `rustc --explain E0277`.
2019-08-14T10:22:22.7279512Z error: Could not compile `core`.
2019-08-14T10:22:22.7280017Z warning: build failed, waiting for other jobs to finish...
2019-08-14T10:22:22.7819760Z error: build failed
2019-08-14T10:22:22.7846070Z command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "check" "--target" "x86_64-unknown-linux-gnu" "-j" "2" "--release" "--color" "always" "--features" "panic-unwind backtrace compiler-builtins-c" "--manifest-path" "/checkout/src/libstd/Cargo.toml" "--message-format" "json"
2019-08-14T10:22:22.7859154Z failed to run: /checkout/obj/build/bootstrap/debug/bootstrap check
2019-08-14T10:22:22.7859358Z Build completed unsuccessfully in 0:02:27
2019-08-14T10:22:22.7859358Z Build completed unsuccessfully in 0:02:27
2019-08-14T10:22:35.2755568Z ##[error]Bash exited with code '1'.
2019-08-14T10:22:35.2796622Z ##[section]Starting: Checkout
2019-08-14T10:22:35.2798339Z ==============================================================================
2019-08-14T10:22:35.2798395Z Task         : Get sources
2019-08-14T10:22:35.2798463Z 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)

@Centril
Copy link
Contributor

Centril commented Aug 14, 2019

r? @scottmcm

@timvermeulen
Copy link
Contributor

self.iter.position(predicate).map(|i| self.len() - i - 1)

I think this won't work because self.len() is called after self.iter.position is called, so it's no longer the original length – you would have to call self.len() first. Alternatively, I think you could also return just self.len() from the closure as self.iter.position will have shortened the iterator by exactly i + 1 elements already.

I have no idea why the build is failing though 😕

@rust-highfive
Copy link
Collaborator

The job mingw-check of your PR failed (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.
2019-08-17T02:42:13.0820721Z ##[command]git remote add origin https://github.com/rust-lang/rust
2019-08-17T02:42:13.1018617Z ##[command]git config gc.auto 0
2019-08-17T02:42:13.1095921Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2019-08-17T02:42:13.1147346Z ##[command]git config --get-all http.proxy
2019-08-17T02:42:13.1288128Z ##[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/63549/merge:refs/remotes/pull/63549/merge
---
2019-08-17T02:42:47.6986991Z do so (now or later) by using -b with the checkout command again. Example:
2019-08-17T02:42:47.6987912Z 
2019-08-17T02:42:47.6989139Z   git checkout -b <new-branch-name>
2019-08-17T02:42:47.6990016Z 
2019-08-17T02:42:47.6990888Z HEAD is now at c4a33fc39 Merge d3fbe6ddc9bc4406a1b193d2757320c0c79fbac5 into bdfd698f37184da42254a03ed466ab1f90e6fb6c
2019-08-17T02:42:47.7126432Z ##[section]Starting: Collect CPU-usage statistics in the background
2019-08-17T02:42:47.7129489Z ==============================================================================
2019-08-17T02:42:47.7129554Z Task         : Bash
2019-08-17T02:42:47.7129606Z Description  : Run a Bash script on macOS, Linux, or Windows
---
2019-08-17T02:48:03.3790769Z Checking rustdoc artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2019-08-17T02:48:03.3810151Z Checking std artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2019-08-17T02:48:03.8021679Z    Compiling cc v1.0.35
2019-08-17T02:48:03.8022094Z     Checking core v0.0.0 (/checkout/src/libcore)
2019-08-17T02:48:10.8679175Z error[E0277]: expected a `ops::function::FnMut<(<I as iter::traits::iterator::Iterator>::Item,)>` closure, found `P`
2019-08-17T02:48:10.8680516Z   --> src/libcore/iter/adapters/mod.rs:75:19
2019-08-17T02:48:10.8681187Z    |
2019-08-17T02:48:10.8682263Z 75 |         self.iter.position(predicate).map(|_| {
2019-08-17T02:48:10.8682774Z    |                   ^^^^^^^^ expected an `FnMut<(<I as iter::traits::iterator::Iterator>::Item,)>` closure, found `P`
2019-08-17T02:48:10.8683026Z    |
2019-08-17T02:48:10.8683771Z    = help: the trait `ops::function::FnMut<(<I as iter::traits::iterator::Iterator>::Item,)>` is not implemented for `P`
2019-08-17T02:48:10.8685118Z    = help: consider adding a `where P: ops::function::FnMut<(<I as iter::traits::iterator::Iterator>::Item,)>` bound
2019-08-17T02:48:12.7228616Z    Compiling libc v0.2.60
2019-08-17T02:48:13.6205335Z    Compiling build_helper v0.1.0 (/checkout/src/build_helper)
2019-08-17T02:48:14.3152407Z error: aborting due to previous error
2019-08-17T02:48:14.3157323Z 
2019-08-17T02:48:14.3157323Z 
2019-08-17T02:48:14.3163276Z For more information about this error, try `rustc --explain E0277`.
2019-08-17T02:48:14.4048176Z error: Could not compile `core`.
2019-08-17T02:48:14.4136963Z warning: build failed, waiting for other jobs to finish...
2019-08-17T02:48:14.8438941Z error: build failed
2019-08-17T02:48:14.8516318Z command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "check" "--target" "x86_64-unknown-linux-gnu" "-Zbinary-dep-depinfo" "-j" "2" "--release" "--color" "always" "--features" "panic-unwind backtrace compiler-builtins-c" "--manifest-path" "/checkout/src/libstd/Cargo.toml" "--message-format" "json-render-diagnostics"
2019-08-17T02:48:14.8519039Z failed to run: /checkout/obj/build/bootstrap/debug/bootstrap check
2019-08-17T02:48:14.8519330Z Build completed unsuccessfully in 0:02:39
2019-08-17T02:48:14.8586956Z == clock drift check ==
2019-08-17T02:48:14.8612578Z   local time: Sat Aug 17 02:48:14 UTC 2019
2019-08-17T02:48:14.8612578Z   local time: Sat Aug 17 02:48:14 UTC 2019
2019-08-17T02:48:15.0154764Z   network time: Sat, 17 Aug 2019 02:48:15 GMT
2019-08-17T02:48:15.0158994Z == end clock drift check ==
2019-08-17T02:48:28.1361534Z ##[error]Bash exited with code '1'.
2019-08-17T02:48:28.1399079Z ##[section]Starting: Checkout
2019-08-17T02:48:28.1401403Z ==============================================================================
2019-08-17T02:48:28.1401486Z Task         : Get sources
2019-08-17T02:48:28.1401539Z 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)

@scottmcm scottmcm added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 17, 2019
@rust-highfive
Copy link
Collaborator

The job mingw-check of your PR failed (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.
2019-08-18T21:34:33.7366212Z ##[command]git remote add origin https://github.com/rust-lang/rust
2019-08-18T21:34:33.7540134Z ##[command]git config gc.auto 0
2019-08-18T21:34:33.7608657Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2019-08-18T21:34:33.7671089Z ##[command]git config --get-all http.proxy
2019-08-18T21:34:33.7796510Z ##[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/63549/merge:refs/remotes/pull/63549/merge
---
2019-08-18T21:35:07.6108416Z do so (now or later) by using -b with the checkout command again. Example:
2019-08-18T21:35:07.6109185Z 
2019-08-18T21:35:07.6142439Z   git checkout -b <new-branch-name>
2019-08-18T21:35:07.6143228Z 
2019-08-18T21:35:07.6143921Z HEAD is now at f03a3178f Merge 95af12fbef099a48ce475f21736b9717d4bcdeaf into ea52be482ab4945fda63cb65b6a198309a041e3c
2019-08-18T21:35:07.6249765Z ##[section]Starting: Collect CPU-usage statistics in the background
2019-08-18T21:35:07.6257525Z ==============================================================================
2019-08-18T21:35:07.6257588Z Task         : Bash
2019-08-18T21:35:07.6257655Z Description  : Run a Bash script on macOS, Linux, or Windows
---
2019-08-18T21:40:32.5545805Z Checking rustdoc artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2019-08-18T21:40:32.5564803Z Checking std artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2019-08-18T21:40:32.9895223Z    Compiling cc v1.0.35
2019-08-18T21:40:32.9895641Z     Checking core v0.0.0 (/checkout/src/libcore)
2019-08-18T21:40:40.0784821Z error[E0277]: expected a `ops::function::FnMut<(<I as iter::traits::iterator::Iterator>::Item,)>` closure, found `P`
2019-08-18T21:40:40.0785255Z   --> src/libcore/iter/adapters/mod.rs:75:34
2019-08-18T21:40:40.0785526Z    |
2019-08-18T21:40:40.0785826Z 75 |         let position = self.iter.position(predicate);
2019-08-18T21:40:40.0786277Z    |                                  ^^^^^^^^ expected an `FnMut<(<I as iter::traits::iterator::Iterator>::Item,)>` closure, found `P`
2019-08-18T21:40:40.0786516Z    |
2019-08-18T21:40:40.0787127Z    = help: the trait `ops::function::FnMut<(<I as iter::traits::iterator::Iterator>::Item,)>` is not implemented for `P`
2019-08-18T21:40:40.0787553Z    = help: consider adding a `where P: ops::function::FnMut<(<I as iter::traits::iterator::Iterator>::Item,)>` bound
2019-08-18T21:40:41.4248884Z    Compiling libc v0.2.60
2019-08-18T21:40:42.2795519Z    Compiling build_helper v0.1.0 (/checkout/src/build_helper)
2019-08-18T21:40:43.4118688Z error: aborting due to previous error
2019-08-18T21:40:43.4118804Z 
2019-08-18T21:40:43.4118804Z 
2019-08-18T21:40:43.4124076Z For more information about this error, try `rustc --explain E0277`.
2019-08-18T21:40:43.5127440Z error: Could not compile `core`.
2019-08-18T21:40:43.5141506Z warning: build failed, waiting for other jobs to finish...
2019-08-18T21:40:43.6838749Z error: build failed
2019-08-18T21:40:43.6866435Z command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "check" "--target" "x86_64-unknown-linux-gnu" "-Zbinary-dep-depinfo" "-j" "2" "--release" "--color" "always" "--features" "panic-unwind backtrace compiler-builtins-c" "--manifest-path" "/checkout/src/libstd/Cargo.toml" "--message-format" "json-render-diagnostics"
2019-08-18T21:40:43.6875633Z failed to run: /checkout/obj/build/bootstrap/debug/bootstrap check
2019-08-18T21:40:43.6875703Z Build completed unsuccessfully in 0:02:40
2019-08-18T21:40:43.6924119Z == clock drift check ==
2019-08-18T21:40:43.6945638Z   local time: Sun Aug 18 21:40:43 UTC 2019
2019-08-18T21:40:43.6945638Z   local time: Sun Aug 18 21:40:43 UTC 2019
2019-08-18T21:40:43.8419126Z   network time: Sun, 18 Aug 2019 21:40:43 GMT
2019-08-18T21:40:43.8422598Z == end clock drift check ==
2019-08-18T21:40:58.1565212Z ##[error]Bash exited with code '1'.
2019-08-18T21:40:58.1597729Z ##[section]Starting: Checkout
2019-08-18T21:40:58.1599406Z ==============================================================================
2019-08-18T21:40:58.1599463Z Task         : Get sources
2019-08-18T21:40:58.1599510Z 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)

@rust-highfive
Copy link
Collaborator

The job mingw-check of your PR failed (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.
2019-08-18T22:22:47.8176810Z ##[command]git remote add origin https://github.com/rust-lang/rust
2019-08-18T22:22:47.8392001Z ##[command]git config gc.auto 0
2019-08-18T22:22:47.8470777Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2019-08-18T22:22:47.8517207Z ##[command]git config --get-all http.proxy
2019-08-18T22:22:47.8676645Z ##[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/63549/merge:refs/remotes/pull/63549/merge
---
2019-08-18T22:23:22.5260822Z do so (now or later) by using -b with the checkout command again. Example:
2019-08-18T22:23:22.5262380Z 
2019-08-18T22:23:22.5264933Z   git checkout -b <new-branch-name>
2019-08-18T22:23:22.5266170Z 
2019-08-18T22:23:22.5267186Z HEAD is now at 09790f6f2 Merge 137bfd7a7e983267f7ed35607dbed199cb2c6643 into 4cf7673076e6975532213e494dd3f7f9d8c2328e
2019-08-18T22:23:22.5429800Z ##[section]Starting: Collect CPU-usage statistics in the background
2019-08-18T22:23:22.5432973Z ==============================================================================
2019-08-18T22:23:22.5433031Z Task         : Bash
2019-08-18T22:23:22.5433097Z Description  : Run a Bash script on macOS, Linux, or Windows
---
2019-08-18T22:28:32.0712231Z     Checking core v0.0.0 (/checkout/src/libcore)
2019-08-18T22:28:37.5404320Z error[E0276]: impl has stricter requirements than trait
2019-08-18T22:28:37.5405470Z     --> src/libcore/iter/adapters/mod.rs:71:5
2019-08-18T22:28:37.5406729Z      |
2019-08-18T22:28:37.5408158Z 71   | /     fn rposition<P>(&mut self, predicate: P) -> Option<usize> where
2019-08-18T22:28:37.5408980Z 72   | |         P: FnMut(<I as Iterator>::Item) -> bool,
2019-08-18T22:28:37.5409920Z 73   | |         Self: ExactSizeIterator,
2019-08-18T22:28:37.5411156Z ...    |
2019-08-18T22:28:37.5411845Z 79   | |         })
2019-08-18T22:28:37.5412642Z 80   | |     }
2019-08-18T22:28:37.5412642Z 80   | |     }
2019-08-18T22:28:37.5413407Z      | |_____^ impl has extra requirement `P: ops::function::FnMut<(<I as iter::traits::iterator::Iterator>::Item,)>`
2019-08-18T22:28:37.5414588Z     ::: src/libcore/iter/traits/iterator.rs:2131:5
2019-08-18T22:28:37.5415058Z      |
2019-08-18T22:28:37.5415058Z      |
2019-08-18T22:28:37.5416002Z 2131 | /     fn rposition<P>(&mut self, predicate: P) -> Option<usize> where
2019-08-18T22:28:37.5416798Z 2132 | |         P: FnMut(Self::Item) -> bool,
2019-08-18T22:28:37.5417459Z 2133 | |         Self: Sized + ExactSizeIterator + DoubleEndedIterator
2019-08-18T22:28:37.5418574Z ...    |
2019-08-18T22:28:37.5418574Z ...    |
2019-08-18T22:28:37.5419372Z 2149 | |         self.try_rfold(n, check(predicate)).break_value()
2019-08-18T22:28:37.5419875Z 2150 | |     }
2019-08-18T22:28:37.5420416Z      | |_____- definition of `rposition` from trait
2019-08-18T22:28:41.3679959Z    Compiling libc v0.2.60
2019-08-18T22:28:41.8499858Z    Compiling build_helper v0.1.0 (/checkout/src/build_helper)
2019-08-18T22:28:42.5158190Z error: aborting due to previous error
2019-08-18T22:28:42.5158429Z 
2019-08-18T22:28:42.5158429Z 
2019-08-18T22:28:42.5163960Z For more information about this error, try `rustc --explain E0276`.
2019-08-18T22:28:42.6101099Z error: Could not compile `core`.
2019-08-18T22:28:42.6101934Z warning: build failed, waiting for other jobs to finish...
2019-08-18T22:28:43.0729316Z error: build failed
2019-08-18T22:28:43.0752482Z command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "check" "--target" "x86_64-unknown-linux-gnu" "-Zbinary-dep-depinfo" "-j" "2" "--release" "--color" "always" "--features" "panic-unwind backtrace compiler-builtins-c" "--manifest-path" "/checkout/src/libstd/Cargo.toml" "--message-format" "json-render-diagnostics"
2019-08-18T22:28:43.0763120Z failed to run: /checkout/obj/build/bootstrap/debug/bootstrap check
2019-08-18T22:28:43.0763399Z Build completed unsuccessfully in 0:02:30
2019-08-18T22:28:43.0815158Z == clock drift check ==
2019-08-18T22:28:43.0831648Z   local time: Sun Aug 18 22:28:43 UTC 2019
2019-08-18T22:28:43.0831648Z   local time: Sun Aug 18 22:28:43 UTC 2019
2019-08-18T22:28:43.1673521Z   network time: Sun, 18 Aug 2019 22:28:43 GMT
2019-08-18T22:28:43.1677236Z == end clock drift check ==
2019-08-18T22:28:56.1902649Z ##[error]Bash exited with code '1'.
2019-08-18T22:28:56.1937130Z ##[section]Starting: Checkout
2019-08-18T22:28:56.1938982Z ==============================================================================
2019-08-18T22:28:56.1939038Z Task         : Get sources
2019-08-18T22:28:56.1939088Z 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)

@timvermeulen
Copy link
Contributor

It seems like adding the Self: ExactSizeIterator bound makes the compiler no longer realize that Self::Item and I::Item are the same, for whatever reason 🤔

@rust-highfive
Copy link
Collaborator

The job mingw-check of your PR failed (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.
2019-08-19T00:25:46.6478455Z ##[command]git remote add origin https://github.com/rust-lang/rust
2019-08-19T00:25:46.6677665Z ##[command]git config gc.auto 0
2019-08-19T00:25:46.6764623Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2019-08-19T00:25:46.6818086Z ##[command]git config --get-all http.proxy
2019-08-19T00:25:46.6955846Z ##[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/63549/merge:refs/remotes/pull/63549/merge
---
2019-08-19T00:26:22.2032755Z do so (now or later) by using -b with the checkout command again. Example:
2019-08-19T00:26:22.2032785Z 
2019-08-19T00:26:22.2033013Z   git checkout -b <new-branch-name>
2019-08-19T00:26:22.2033043Z 
2019-08-19T00:26:22.2033090Z HEAD is now at 8a1b0e0da Merge 1d2274e31210c689120e1d6ac6194e9b38cc54a2 into 4cf7673076e6975532213e494dd3f7f9d8c2328e
2019-08-19T00:26:22.2214837Z ##[section]Starting: Collect CPU-usage statistics in the background
2019-08-19T00:26:22.2217947Z ==============================================================================
2019-08-19T00:26:22.2218027Z Task         : Bash
2019-08-19T00:26:22.2218093Z Description  : Run a Bash script on macOS, Linux, or Windows
---
2019-08-19T00:31:27.7399286Z     Checking core v0.0.0 (/checkout/src/libcore)
2019-08-19T00:31:33.2496403Z error[E0276]: impl has stricter requirements than trait
2019-08-19T00:31:33.2496762Z     --> src/libcore/iter/adapters/mod.rs:71:5
2019-08-19T00:31:33.2497018Z      |
2019-08-19T00:31:33.2497404Z 71   | /     fn rposition<P>(&mut self, predicate: P) -> Option<usize> where
2019-08-19T00:31:33.2497730Z 72   | |         P: FnMut(Self::Item) -> bool,
2019-08-19T00:31:33.2498103Z 73   | |         P: FnMut(<I as Iterator>::Item) -> bool,
2019-08-19T00:31:33.2498565Z 74   | |         Self: ExactSizeIterator,
2019-08-19T00:31:33.2499092Z 80   | |         })
2019-08-19T00:31:33.2499363Z 81   | |     }
2019-08-19T00:31:33.2499363Z 81   | |     }
2019-08-19T00:31:33.2499739Z      | |_____^ impl has extra requirement `P: ops::function::FnMut<(<I as iter::traits::iterator::Iterator>::Item,)>`
2019-08-19T00:31:33.2500221Z     ::: src/libcore/iter/traits/iterator.rs:2131:5
2019-08-19T00:31:33.2500447Z      |
2019-08-19T00:31:33.2500447Z      |
2019-08-19T00:31:33.2500766Z 2131 | /     fn rposition<P>(&mut self, predicate: P) -> Option<usize> where
2019-08-19T00:31:33.2501066Z 2132 | |         P: FnMut(Self::Item) -> bool,
2019-08-19T00:31:33.2501407Z 2133 | |         Self: Sized + ExactSizeIterator + DoubleEndedIterator
2019-08-19T00:31:33.2502794Z ...    |
2019-08-19T00:31:33.2502794Z ...    |
2019-08-19T00:31:33.2503178Z 2149 | |         self.try_rfold(n, check(predicate)).break_value()
2019-08-19T00:31:33.2503663Z 2150 | |     }
2019-08-19T00:31:33.2504006Z      | |_____- definition of `rposition` from trait
2019-08-19T00:31:37.0956721Z    Compiling libc v0.2.60
2019-08-19T00:31:38.0326669Z    Compiling build_helper v0.1.0 (/checkout/src/build_helper)
2019-08-19T00:31:38.4602899Z error: aborting due to previous error
2019-08-19T00:31:38.4605829Z 
2019-08-19T00:31:38.4605829Z 
2019-08-19T00:31:38.4644742Z For more information about this error, try `rustc --explain E0276`.
2019-08-19T00:31:38.5562933Z error: Could not compile `core`.
2019-08-19T00:31:38.5563341Z warning: build failed, waiting for other jobs to finish...
2019-08-19T00:31:39.1479897Z error: build failed
2019-08-19T00:31:39.1516953Z command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "check" "--target" "x86_64-unknown-linux-gnu" "-Zbinary-dep-depinfo" "-j" "2" "--release" "--color" "always" "--features" "panic-unwind backtrace compiler-builtins-c" "--manifest-path" "/checkout/src/libstd/Cargo.toml" "--message-format" "json-render-diagnostics"
2019-08-19T00:31:39.1523850Z failed to run: /checkout/obj/build/bootstrap/debug/bootstrap check
2019-08-19T00:31:39.1524112Z Build completed unsuccessfully in 0:02:34
2019-08-19T00:31:39.1579618Z == clock drift check ==
2019-08-19T00:31:39.1591379Z   local time: Mon Aug 19 00:31:39 UTC 2019
2019-08-19T00:31:39.1591379Z   local time: Mon Aug 19 00:31:39 UTC 2019
2019-08-19T00:31:39.3111863Z   network time: Mon, 19 Aug 2019 00:31:39 GMT
2019-08-19T00:31:39.3115286Z == end clock drift check ==
2019-08-19T00:31:49.4092478Z ##[error]Bash exited with code '1'.
2019-08-19T00:31:49.4135707Z ##[section]Starting: Checkout
2019-08-19T00:31:49.4137642Z ==============================================================================
2019-08-19T00:31:49.4137738Z Task         : Get sources
2019-08-19T00:31:49.4137784Z 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)

@sfanxiang
Copy link
Contributor Author

I wonder why this is happening too, if the original code builds fine.

@timvermeulen
Copy link
Contributor

The original code doesn't have the Self: ExactSizeIterator bound (the default implementation does, but not the incorrect implementation of Rev itself) so that has to be the cause.

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-6.0 of your PR failed (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.
2019-08-20T22:24:52.0127983Z ##[command]git remote add origin https://github.com/rust-lang/rust
2019-08-20T22:24:52.0351558Z ##[command]git config gc.auto 0
2019-08-20T22:24:52.0436492Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2019-08-20T22:24:52.0494162Z ##[command]git config --get-all http.proxy
2019-08-20T22:24:52.0662660Z ##[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/63549/merge:refs/remotes/pull/63549/merge
---
2019-08-20T22:25:28.6449977Z do so (now or later) by using -b with the checkout command again. Example:
2019-08-20T22:25:28.6450024Z 
2019-08-20T22:25:28.6450247Z   git checkout -b <new-branch-name>
2019-08-20T22:25:28.6450827Z 
2019-08-20T22:25:28.6450882Z HEAD is now at 550356b43 Merge bba839dc10f9bd5c37d5264f33851bc91c5af910 into bea0372a1a7a31b81f28cc4d9a83a2dc9a79d008
2019-08-20T22:25:28.6634624Z ##[section]Starting: Collect CPU-usage statistics in the background
2019-08-20T22:25:28.6637244Z ==============================================================================
2019-08-20T22:25:28.6637315Z Task         : Bash
2019-08-20T22:25:28.6637357Z Description  : Run a Bash script on macOS, Linux, or Windows
---
2019-08-20T23:29:48.4628380Z .................................................................................................... 1500/8942
2019-08-20T23:29:54.2038847Z .................................................................................................... 1600/8942
2019-08-20T23:30:07.7138935Z ........................................i...............i........................................... 1700/8942
2019-08-20T23:30:16.1146539Z .................................................................................................... 1800/8942
2019-08-20T23:30:31.1451060Z ................................iiiii............................................................... 1900/8942
2019-08-20T23:30:42.2463297Z .................................................................................................... 2100/8942
2019-08-20T23:30:44.9527590Z .................................................................................................... 2200/8942
2019-08-20T23:30:49.8729433Z .................................................................................................... 2300/8942
2019-08-20T23:30:57.1980892Z .................................................................................................... 2400/8942
---
2019-08-20T23:33:58.0899170Z .................................................................................................... 4600/8942
2019-08-20T23:34:05.0201247Z ..................i...............i................................................................. 4700/8942
2019-08-20T23:34:17.0596471Z .................................................................................................... 4800/8942
2019-08-20T23:34:23.3560460Z .................................................................................................... 4900/8942
2019-08-20T23:34:34.9193881Z ...................................................................................................i 5000/8942
2019-08-20T23:34:40.3944865Z i.ii................................................................................................ 5100/8942
2019-08-20T23:34:55.6668321Z .................................................................................................... 5300/8942
2019-08-20T23:35:02.9656902Z .......................................................i............................................ 5400/8942
2019-08-20T23:35:10.1454077Z .................................................................................................... 5500/8942
2019-08-20T23:35:20.4423924Z .................................................................................................... 5600/8942
2019-08-20T23:35:20.4423924Z .................................................................................................... 5600/8942
2019-08-20T23:35:29.9321778Z ................................................ii...i..ii...........i.............................. 5700/8942
2019-08-20T23:35:53.1623562Z .................................................................................................... 5900/8942
2019-08-20T23:35:58.2458674Z .................................................................................................... 6000/8942
2019-08-20T23:35:58.2458674Z .................................................................................................... 6000/8942
2019-08-20T23:36:10.0124587Z .................................................i..ii.............................................. 6100/8942
2019-08-20T23:36:34.6440025Z ................................................................................................i... 6300/8942
2019-08-20T23:36:36.9950321Z .................................................................................................... 6400/8942
2019-08-20T23:36:39.3591207Z ...................................................................i................................ 6500/8942
2019-08-20T23:36:42.4962818Z .................................................................................................... 6600/8942
---
2019-08-20T23:41:34.0426452Z  finished in 19.890
2019-08-20T23:41:34.0427371Z Check compiletest suite=codegen mode=codegen (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2019-08-20T23:41:34.0427683Z 
2019-08-20T23:41:34.0427845Z running 148 tests
2019-08-20T23:41:37.2841970Z i....iii......iii..iiii....i............................i..i..................i....i.........ii.i.i. 100/148
2019-08-20T23:41:39.2665254Z .iiii..............i.........iii.i......ii......
2019-08-20T23:41:39.2665923Z 
2019-08-20T23:41:39.2669630Z  finished in 5.518
2019-08-20T23:41:39.2859612Z Check compiletest suite=codegen-units mode=codegen-units (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2019-08-20T23:41:39.4665810Z 
---
2019-08-20T23:41:41.6268730Z  finished in 2.341
2019-08-20T23:41:41.6456349Z Check compiletest suite=assembly mode=assembly (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2019-08-20T23:41:41.8080655Z 
2019-08-20T23:41:41.8081483Z running 9 tests
2019-08-20T23:41:41.8082399Z iiiiiiiii
2019-08-20T23:41:41.8083231Z 
2019-08-20T23:41:41.8087182Z  finished in 0.163
2019-08-20T23:41:41.8280282Z Check compiletest suite=incremental mode=incremental (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2019-08-20T23:41:42.0189906Z 
---
2019-08-20T23:42:00.6752026Z  finished in 18.847
2019-08-20T23:42:00.6989999Z Check compiletest suite=debuginfo mode=debuginfo-gdb+lldb (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2019-08-20T23:42:00.8939131Z 
2019-08-20T23:42:00.8939509Z running 122 tests
2019-08-20T23:42:25.7061561Z .iiiii...i.....i..i...i..i.i.i..i.ii..i.i.....i..i....i..........iiii..........i...ii...i.......ii.i 100/122
2019-08-20T23:42:30.5634521Z .i.i......iii.i.....ii
2019-08-20T23:42:30.5635092Z 
2019-08-20T23:42:30.5638840Z  finished in 29.865
2019-08-20T23:42:30.5647063Z Uplifting stage1 rustc (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2019-08-20T23:42:30.5647738Z Copying stage2 rustc from stage1 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu / x86_64-unknown-linux-gnu)
---
2019-08-20T23:55:51.6804758Z 
2019-08-20T23:55:51.6923045Z  finished in 173.806
2019-08-20T23:55:51.6938729Z Testing core stage1 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2019-08-20T23:55:51.8711067Z    Compiling core v0.0.0 (/checkout/src/libcore)
2019-08-20T23:55:58.5240753Z error[E0271]: type mismatch resolving `<std::iter::Rev<std::ops::Range<i32>> as std::iter::Iterator>::Item == isize`
2019-08-20T23:55:58.5243606Z     --> src/libcore/../libcore/tests/iter.rs:1979:41
2019-08-20T23:55:58.5244237Z      |
2019-08-20T23:55:58.5244741Z 1979 |     assert_eq!((1..21).rev().step_by(5).collect::<Vec<isize>>(), [20, 15, 10, 5]);
2019-08-20T23:55:58.5245514Z      |                                         ^^^^^^^ expected i32, found isize
2019-08-20T23:55:58.5246453Z      = note: expected type `i32`
2019-08-20T23:55:58.5246884Z                 found type `isize`
2019-08-20T23:55:58.5247040Z 
2019-08-20T23:55:58.5247040Z 
2019-08-20T23:55:58.5247795Z error[E0271]: type mismatch resolving `<std::iter::Rev<std::ops::Range<i32>> as std::iter::Iterator>::Item == isize`
2019-08-20T23:55:58.5248226Z     --> src/libcore/../libcore/tests/iter.rs:1980:41
2019-08-20T23:55:58.5248579Z      |
2019-08-20T23:55:58.5249042Z 1980 |     assert_eq!((1..21).rev().step_by(6).collect::<Vec<isize>>(), [20, 14, 8, 2]);
2019-08-20T23:55:58.5249523Z      |                                         ^^^^^^^ expected i32, found isize
2019-08-20T23:55:58.5250697Z      = note: expected type `i32`
2019-08-20T23:55:58.5251084Z                 found type `isize`
2019-08-20T23:55:58.5251228Z 
2019-08-20T23:56:05.1389582Z error: aborting due to 2 previous errors
2019-08-20T23:56:05.1389582Z error: aborting due to 2 previous errors
2019-08-20T23:56:05.1390425Z 
2019-08-20T23:56:05.1391028Z For more information about this error, try `rustc --explain E0271`.
2019-08-20T23:56:05.2690241Z error: Could not compile `core`.
2019-08-20T23:56:05.2691170Z 
2019-08-20T23:56:05.2691765Z To learn more, run the command again with --verbose.
2019-08-20T23:56:05.2721145Z 
2019-08-20T23:56:05.2721467Z 
2019-08-20T23:56:05.2722369Z command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "test" "--target" "x86_64-unknown-linux-gnu" "-Zbinary-dep-depinfo" "-j" "2" "--release" "--locked" "--color" "always" "--features" "panic-unwind backtrace compiler-builtins-c" "--manifest-path" "/checkout/src/libstd/Cargo.toml" "-p" "core" "--" "--quiet"
2019-08-20T23:56:05.2722796Z 
2019-08-20T23:56:05.2722921Z 
2019-08-20T23:56:05.2730322Z failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
2019-08-20T23:56:05.2730575Z Build completed unsuccessfully in 1:24:08
2019-08-20T23:56:05.2730575Z Build completed unsuccessfully in 1:24:08
2019-08-20T23:56:05.2787579Z == clock drift check ==
2019-08-20T23:56:05.2802548Z   local time: Tue Aug 20 23:56:05 UTC 2019
2019-08-20T23:56:05.4301329Z   network time: Tue, 20 Aug 2019 23:56:05 GMT
2019-08-20T23:56:05.4302720Z == end clock drift check ==
2019-08-20T23:56:06.0131539Z ##[error]Bash exited with code '1'.
2019-08-20T23:56:06.0176883Z ##[section]Starting: Checkout
2019-08-20T23:56:06.0199062Z ==============================================================================
2019-08-20T23:56:06.0199137Z Task         : Get sources
2019-08-20T23:56:06.0199183Z 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)

@sfanxiang
Copy link
Contributor Author

I'm totally confused. Where does i32 come from? 🤔

@Alexendoo
Copy link
Member

Ping from triage, @scottmcm any ideas what's causing that type inference issue?

Because of a compiler bug that adding `Self: ExactSizeIterator` makes
the compiler forget `Self::Item` is `<I as Iterator>::Item`, we remove
this specialization for now.
@sfanxiang
Copy link
Contributor Author

@scottmcm Removed Rev::rposition for now due to compile error. Could you please review?

And what's the performance gain of specializing rposition anyway? It will always have to iterate over the values passed to predicate, starting from next_back().

@timvermeulen
Copy link
Contributor

And what's the performance gain of specializing rposition anyway?

I think that was only useful before the try_fold days (since repeated next calls don't use internal iteration and fold doesn't short-circuit).

@scottmcm
Copy link
Member

scottmcm commented Sep 4, 2019

It could theoretically matter if the underlying iterator had some special implementation (like if there was a memchr-iterator or something), but it's definitely far less useful in the current try_rfold world. So just removing it and fixing the bug with usually no cost sounds like a good approach to me.

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Sep 4, 2019

📌 Commit 0e597d4 has been approved by scottmcm

@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 Sep 4, 2019
Centril added a commit to Centril/rust that referenced this pull request Sep 5, 2019
Rev::rposition counts from the wrong end

Introduced in rust-lang#43074.

cc @SimonSapin
Centril added a commit to Centril/rust that referenced this pull request Sep 5, 2019
Rev::rposition counts from the wrong end

Introduced in rust-lang#43074.

cc @SimonSapin
bors added a commit that referenced this pull request Sep 5, 2019
Rollup of 15 pull requests

Successful merges:

 - #62860 (Stabilize checked_duration_since for 1.38.0)
 - #63549 (Rev::rposition counts from the wrong end)
 - #63985 (Stabilize pin_into_inner in 1.39.0)
 - #64005 (Add a `Place::is_indirect` method to determine whether a `Place` contains a `Deref` projection)
 - #64031 (Harden `param_attrs` test wrt. usage of a proc macro `#[attr]`)
 - #64038 (Check impl trait substs when checking for recursive types)
 - #64043 (Add some more tests for underscore imports)
 - #64092 (Update xLTO compatibility table in rustc book.)
 - #64110 (Refer to "`self` type" instead of "receiver type")
 - #64120 (Move path parsing earlier)
 - #64123 (Added warning around code with reference to uninit bytes)
 - #64128 (unused_parens: account for or-patterns and `&(mut x)`)
 - #64141 (Minimize uses of `LocalInternedString`)
 - #64142 (Fix doc links in `std::cmp` module)
 - #64148 (fix a few typos in comments)

Failed merges:

r? @ghost
@bors bors merged commit 0e597d4 into rust-lang:master Sep 5, 2019
@sfanxiang sfanxiang deleted the rev-rposition branch September 5, 2019 15:14
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.

None yet

8 participants