Skip to content

Implement DoubleEndedIterator::next_chunk_back#156737

Open
asder8215 wants to merge 4 commits into
rust-lang:mainfrom
asder8215:double_ended_iterator_next_chunk_back
Open

Implement DoubleEndedIterator::next_chunk_back#156737
asder8215 wants to merge 4 commits into
rust-lang:mainfrom
asder8215:double_ended_iterator_next_chunk_back

Conversation

@asder8215
Copy link
Copy Markdown
Contributor

@asder8215 asder8215 commented May 19, 2026

This PR builds off on @vinDelphini's PR on introducing DoubleEndedIterator::next_chunk_back (which will be used in a follow up PR to optimize ArrayChunks::try_rfold once merged). This was in the works since late Jan and I thought to pick it up and get this over the finish line as vinDelphini has been away from the PR for a couple of months. I've made sure to pull from vinDelphini's branch to keep him authored on the commits he made.

Other things introduced from this PR is specialization like done for Iterator::next_chunk, constifying some stuff, making a custom DoubleEndedIterator::next_chunk_back for IntoIter (since it also has a custom impl of Iterator::next_chunk), and a bunch of tests mirroring that of Iterator::next_chunk.

There's no tracking issue for this yet, but the ACP for this introduction is here. I'll create the tracking issue for this soon.


Actually, can we have DoubleEndedIterator::next_chunk_back underneath Iterator::next_chunk tracking issue?

vinDelphini and others added 3 commits May 18, 2026 20:01
Clarify that GuardBack initializes arrays from the end.

Restore performance note for iter_next_chunk_erased regarding optimization issues.
I copied the impl block from Guard without noticing that Destruct was only there for const contexts. Consumed the suggestion, thanks.

Co-authored-by: Chayim Refael Friedman <chayimfr@gmail.com>
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels May 19, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented May 19, 2026

r? @tgross35

rustbot has assigned @tgross35.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: libs
  • libs expanded to 7 candidates
  • Random selection from Mark-Simulacrum, tgross35

@asder8215 asder8215 force-pushed the double_ended_iterator_next_chunk_back branch from 7cb34f0 to 210d0a1 Compare May 19, 2026 03:11
@rust-log-analyzer

This comment has been minimized.

@asder8215 asder8215 force-pushed the double_ended_iterator_next_chunk_back branch from 210d0a1 to 41f9ab9 Compare May 19, 2026 04:27
@rust-log-analyzer

This comment has been minimized.

@asder8215 asder8215 force-pushed the double_ended_iterator_next_chunk_back branch from 41f9ab9 to 0688940 Compare May 19, 2026 05:12
@rust-log-analyzer

This comment has been minimized.

…troduced next_chunk_back implementation in IntoIter, updated documentation, and added test cases for DoubleEndedIterator::next_chunk_back
@asder8215 asder8215 force-pushed the double_ended_iterator_next_chunk_back branch from 0688940 to 9d29265 Compare May 19, 2026 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. 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.

5 participants