Skip to content

Specialize advance_back_by like the forward version - #163361

Open
cuviper wants to merge 1 commit into
rust-lang:mainfrom
cuviper:sync-advance_back_by
Open

cuviper wants to merge 1 commit into
rust-lang:mainfrom
cuviper:sync-advance_back_by

Conversation

@cuviper

@cuviper cuviper commented Sep 25, 2026 •

Copy link
Copy Markdown
Member

We specialized advance_by in #141086, so it makes sense to have
advance_back_by use the same trick in reverse, i.e. try_rfold.

This also updates nth_back to mirror nth, and the rest of the
DoubleEndedIterator methods already match Iterator.

We specialized `advance_by` in rust-lang#141086, so it makes sense to have
`advance_back_by` use the same trick in reverse, i.e. `try_rfold`.

This also updates `nth_back` to mirror `nth`, and the rest of the
`DoubleEndedIterator` methods already match `Iterator`.
@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 Sep 25, 2026
@rustbot

rustbot commented Sep 25, 2026

Copy link
Copy Markdown
Collaborator

r? @Darksonn

rustbot has assigned @Darksonn.
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 12 candidates
  • Random selection from 6 candidates

@rustbot

rustbot commented Sep 25, 2026

Copy link
Copy Markdown
Collaborator

⚠️ Warning ⚠️

  • There are issue links (such as #123) in the commit messages of the following commits.
    Please move them to the PR description, to avoid spamming the issues with references to the commit, and so this bot can automatically canonicalize them to avoid issues with subtree.

@cuviper

cuviper commented Sep 25, 2026

Copy link
Copy Markdown
Member Author

The previous PR used a Cycle<slice::Iter> to demonstrate the benefit, but that doesn't work in reverse. Here's a different example with Flatten: https://iter.godbolt.org/z/ojWT3n9xz

This branch has not been deployed

No deployments
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.

3 participants