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 TrustedRandomAccess for Take iterator adapter #83990

Merged
merged 1 commit into from
Apr 24, 2021

Conversation

the8472
Copy link
Member

@the8472 the8472 commented Apr 8, 2021

TrustedRandomAccess requires the iterator length to fit within usize. take(n) only constrains the upper bound of an iterator. So if the inner is TrustedRandomAccess (which already implies a finite length) then so can be Take.

@rustbot label T-libs-impl

@rustbot rustbot added the T-libs Relevant to the library team, which will review and decide on the PR/issue. label Apr 8, 2021
@rust-highfive
Copy link
Collaborator

r? @kennytm

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 8, 2021
@rust-log-analyzer

This comment has been minimized.

Copy link
Member

@dtolnay dtolnay left a comment

Choose a reason for hiding this comment

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

Great!

@dtolnay
Copy link
Member

dtolnay commented Apr 21, 2021

@bors r+

@bors
Copy link
Contributor

bors commented Apr 21, 2021

📌 Commit 37a5b51 has been approved by dtolnay

@bors
Copy link
Contributor

bors commented Apr 21, 2021

🌲 The tree is currently closed for pull requests below priority 1000. This pull request will be tested once the tree is reopened.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 21, 2021
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Apr 22, 2021
implement `TrustedRandomAccess` for `Take` iterator adapter

`TrustedRandomAccess` requires the iterator length to fit within `usize`. `take(n)` only constrains the upper bound of an iterator. So if the inner is `TrustedRandomAccess` (which already implies a finite length) then so can be `Take`.

`@rustbot` label T-libs-impl
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Apr 22, 2021
implement `TrustedRandomAccess` for `Take` iterator adapter

`TrustedRandomAccess` requires the iterator length to fit within `usize`. `take(n)` only constrains the upper bound of an iterator. So if the inner is `TrustedRandomAccess` (which already implies a finite length) then so can be `Take`.

``@rustbot`` label T-libs-impl
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Apr 22, 2021
implement `TrustedRandomAccess` for `Take` iterator adapter

`TrustedRandomAccess` requires the iterator length to fit within `usize`. `take(n)` only constrains the upper bound of an iterator. So if the inner is `TrustedRandomAccess` (which already implies a finite length) then so can be `Take`.

```@rustbot``` label T-libs-impl
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Apr 22, 2021
implement `TrustedRandomAccess` for `Take` iterator adapter

`TrustedRandomAccess` requires the iterator length to fit within `usize`. `take(n)` only constrains the upper bound of an iterator. So if the inner is `TrustedRandomAccess` (which already implies a finite length) then so can be `Take`.

````@rustbot```` label T-libs-impl
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Apr 23, 2021
implement `TrustedRandomAccess` for `Take` iterator adapter

`TrustedRandomAccess` requires the iterator length to fit within `usize`. `take(n)` only constrains the upper bound of an iterator. So if the inner is `TrustedRandomAccess` (which already implies a finite length) then so can be `Take`.

`````@rustbot````` label T-libs-impl
JohnTitor added a commit to JohnTitor/rust that referenced this pull request Apr 23, 2021
implement `TrustedRandomAccess` for `Take` iterator adapter

`TrustedRandomAccess` requires the iterator length to fit within `usize`. `take(n)` only constrains the upper bound of an iterator. So if the inner is `TrustedRandomAccess` (which already implies a finite length) then so can be `Take`.

``````@rustbot`````` label T-libs-impl
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 24, 2021
Rollup of 10 pull requests

Successful merges:

 - rust-lang#83990 (implement `TrustedRandomAccess` for `Take` iterator adapter)
 - rust-lang#84250 (bootstrap: use bash on illumos to run install scripts)
 - rust-lang#84320 (Use details tag for trait implementors.)
 - rust-lang#84436 (Make a few functions private)
 - rust-lang#84453 (Document From implementations for Waker and RawWaker)
 - rust-lang#84458 (Remove unnecessary fields and parameters in rustdoc)
 - rust-lang#84485 (Add some associated type bounds tests)
 - rust-lang#84489 (Mention FusedIterator case in Iterator::fuse doc)
 - rust-lang#84492 (rustdoc: Remove unnecessary dummy span)
 - rust-lang#84496 (Add some specialization tests)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit c00439f into rust-lang:master Apr 24, 2021
@bors
Copy link
Contributor

bors commented Apr 24, 2021

⌛ Testing commit 37a5b51 with merge e11a9fa...

@rustbot rustbot added this to the 1.53.0 milestone Apr 24, 2021
bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 9, 2021
Revert "implement TrustedRandomAccess for Take iterator adapter"

This reverts commit 37a5b51 (rust-lang#83990).

The original change unintentionally caused side-effects from certain iterator chains combining `take`, `zip` and `next_back()` to be omitted which is observable by user code and thus likely a breaking change

Technically one could declare it not a breaking change since `Zip`'s API contract is silent about about its backwards iteration behavior but on the other hand there is nothing in the stable Iterator API that could justify the currently observable behavior. And either way, this impact wasn't noticed or discussed in the original PR.

Fixes rust-lang#85969
@dtolnay dtolnay assigned dtolnay and unassigned kennytm Mar 24, 2024
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. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants