Skip to content

implement TrustedRandomAccess for Take iterator adapter - #83990

Merged
bors merged 1 commit into
rust-lang:masterfrom
the8472:take-trusted-len
Apr 24, 2021
Merged

implement TrustedRandomAccess for Take iterator adapter#83990
bors merged 1 commit into
rust-lang:masterfrom
the8472:take-trusted-len

Conversation

@the8472

Copy link
Copy Markdown
Member

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

@rustbotrustbot 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
Copy Markdown
Contributor

r? @kennytm

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

@rust-highfiverust-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.

@dtolnaydtolnay left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Great!

@dtolnay

Copy link
Copy Markdown
Member

@bors r+

@bors

bors commented Apr 21, 2021

Copy link
Copy Markdown
Collaborator

📌 Commit 37a5b51 has been approved by dtolnay

@bors

bors commented Apr 21, 2021

Copy link
Copy Markdown
Collaborator

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

@borsbors 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
This was referenced Apr 22, 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 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
@JohnTitorJohnTitor mentioned this pull request Apr 23, 2021
@JohnTitorJohnTitor mentioned this pull request Apr 24, 2021
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:masterApr 24, 2021
@bors

bors commented Apr 24, 2021

Copy link
Copy Markdown
Collaborator

⌛ Testing commit 37a5b51 with merge e11a9fa...

@rustbotrustbot 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.
Fixesrust-lang#85969
@dtolnaydtolnay assigned dtolnay and unassigned kennytmMar 24, 2024
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.T-libsRelevant 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

@the8472@rust-highfive@rust-log-analyzer@dtolnay@bors@kennytm@rustbot