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

View all comments

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

@Lfan-ke
Lfan-ke force-pushed the feature/step-by-fused-iterator branch from 741bdbd to 8cf58ce Compare July 26, 2026 12:30
@rustbot

This comment has been minimized.

@jhpratt

jhpratt commented Jul 27, 2026

Copy link
Copy Markdown
Member

r=me with completed FCP. Nominating for that purpose.

@jhpratt jhpratt added I-libs-api-nominated [DEPRECATED; DO NOT USE] T-libs-api [DEPRECATED; DO NOT USE] and removed T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Jul 27, 2026
@rust-bors

This comment has been minimized.

@jhpratt jhpratt added S-waiting-on-t-libs-api [DEPRECATED; DO NOT USE] and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 2, 2026
Signed-off-by: 林晨 (Leo Cheng) <leo-cheng@vip.qq.com>
@Lfan-ke
Lfan-ke force-pushed the feature/step-by-fused-iterator branch from 8cf58ce to 0485003 Compare August 4, 2026 15:02
@rustbot

rustbot commented Aug 4, 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.

@nia-e nia-e removed the I-libs-api-nominated [DEPRECATED; DO NOT USE] label Aug 4, 2026
@madsmtm

madsmtm commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

I think this might be a duplicate of #156999?

@Lfan-ke

Lfan-ke commented Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @madsmtm - you're right, #156999 predates this and implements the same ACP (rust-lang/libs-team#757). I wasn't aware of it when I opened this one. This PR has completed the FCP and carries r=me from @jhpratt, so it's ready to land, but I'm equally happy to close it in favour of #156999 if that's preferred - whichever the team would rather merge.

@nia-e nia-e added S-waiting-on-t-libs Status: Awaiting decision from T-libs and removed S-waiting-on-t-libs-api [DEPRECATED; DO NOT USE] labels Aug 10, 2026
@clarfonthey clarfonthey added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-t-libs Status: Awaiting decision from T-libs labels Aug 11, 2026
@clarfonthey

Copy link
Copy Markdown
Contributor

Fixed labels, @rustbot reroll since I believe @jhpratt has no capacity. (Feel free to steal the review back if you're so inclined.)

@rustbot rustbot assigned Mark-Simulacrum and unassigned jhpratt Aug 11, 2026
@clarfonthey clarfonthey added the S-waiting-on-fcp Status: PR is in FCP and is awaiting for FCP to complete. label Aug 11, 2026
@clarfonthey

Copy link
Copy Markdown
Contributor

(Never mind, there is an FCP on the ACP.)

@jhpratt

jhpratt commented Aug 12, 2026

Copy link
Copy Markdown
Member

r? jhpratt

This has already been reviewed. I looked at everything where I was assigned and rerolled as necessary. If I'm on other PRs, it's by choice :) I appreciate it though!

@clarfonthey

Copy link
Copy Markdown
Contributor

Yeah, my bad here; I had missed that what was missing was FCP, not review. We were doing triage of outstanding FCPs, too…

@clarfonthey clarfonthey added T-libs Relevant to the library team, which will review and decide on the PR/issue. and removed T-libs-api [DEPRECATED; DO NOT USE] labels Aug 12, 2026
@dtolnay

dtolnay commented Aug 14, 2026

Copy link
Copy Markdown
Member

Thanks!

@bors r=jhpratt,dtolnay

@rust-bors

rust-bors Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

📋 This PR cannot be approved because it currently has the following label: S-waiting-on-fcp.

@dtolnay dtolnay removed the S-waiting-on-fcp Status: PR is in FCP and is awaiting for FCP to complete. label Aug 14, 2026
@dtolnay

dtolnay commented Aug 14, 2026

Copy link
Copy Markdown
Member

@bors r=jhpratt,dtolnay

@dtolnay

dtolnay commented Aug 14, 2026

Copy link
Copy Markdown
Member

@bors ping

@rust-bors

rust-bors Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Pong 🏓!

bors build: 1370fb8adc737644249798644e224750d4c0a046

@rust-bors

rust-bors Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 0485003 has been approved by jhpratt,dtolnay

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Aug 14, 2026
@rust-bors

rust-bors Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

This pull request was unapproved.

View changes since this unapproval

@dtolnay

dtolnay commented Aug 14, 2026

Copy link
Copy Markdown
Member

@bors r=jhpratt,dtolnay

@rust-bors

rust-bors Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 0485003 has been approved by jhpratt,dtolnay

It is now in the queue for this repository.

@rust-bors rust-bors Bot 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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Aug 14, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Aug 14, 2026
…ator, r=jhpratt,dtolnay

core: implement FusedIterator for StepBy

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.

```rust
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.
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Aug 14, 2026
…ator, r=jhpratt,dtolnay

core: implement FusedIterator for StepBy

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.

```rust
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.
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.

8 participants