Skip to content

core: implement FusedIterator for StepBy#159963

Open
Lfan-ke wants to merge 1 commit into
rust-lang:mainfrom
Lfan-ke:feature/step-by-fused-iterator
Open

core: implement FusedIterator for StepBy#159963
Lfan-ke wants to merge 1 commit into
rust-lang:mainfrom
Lfan-ke:feature/step-by-fused-iterator

Conversation

@Lfan-ke

@Lfan-ke Lfan-ke commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Implements the accepted ACP rust-lang/libs-team#757.

StepBy yields no more items once its underlying iterator is exhausted, so it is fused whenever the underlying iterator is fused. StepBy was added in 1.28.0, just after the batch of FusedIterator impls stabilized in 1.26.0 (Map, Skip, Take, Enumerate, ...), so it was left out.

impl<I: FusedIterator> FusedIterator for StepBy<I> {}

This is insta-stable, matching the sibling adapter impls, so it needs a libs-api FCP.

Motivation from the ACP: crates with traits refined on top of FusedIterator (e.g. range-set-blaze's SortedStarts) cannot cover StepBy today, even though it would always be valid.

A test_step_by_fused regression test is added.

@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 Jul 26, 2026
@rustbot

rustbot commented Jul 26, 2026

Copy link
Copy Markdown
Collaborator

r? @jhpratt

rustbot has assigned @jhpratt.
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 Darksonn, JohnTitor, Mark-Simulacrum, clarfonthey, jhpratt

Signed-off-by: 林晨 (Leo Cheng) <leo-cheng@vip.qq.com>
@Lfan-ke
Lfan-ke force-pushed the feature/step-by-fused-iterator branch from 741bdbd to 8cf58ce Compare July 26, 2026 12:30
@rustbot

rustbot commented Jul 26, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

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