Skip to content

Conversation

@Dan54
Copy link

@Dan54 Dan54 commented Oct 26, 2025

Remove the A: TrustedStep requirement for std::ops::RangeFrom<A> and std::range::IterRangeFrom<A> to implement TrustedLen.

These iterators cannot return None, so returning (usize::MAX, None) from size_hint() is always correct

@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 Oct 26, 2025
@rustbot
Copy link
Collaborator

rustbot commented Oct 26, 2025

r? @Mark-Simulacrum

rustbot has assigned @Mark-Simulacrum.
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

@hanna-kruppe
Copy link
Contributor

Does this actually make a difference? From a quick glance at the docs, seems like all types that implement Step (required for RangeFrom to be an iterator) also implement TrustedStep.

@Dan54
Copy link
Author

Dan54 commented Oct 26, 2025

Does this actually make a difference? From a quick glance at the docs, seems like all types that implement Step (required for RangeFrom to be an iterator) also implement TrustedStep.

This is true in std, but Step is public, so it may not be true for other crates.

@hanna-kruppe
Copy link
Contributor

It's an unstable trait, though, and judging by the tracking issue it's one that probably won't be stabilized without major changes. So I'd be surprised if other crates are seriously implementing it. Do you have an example in mind?

@Dan54
Copy link
Author

Dan54 commented Oct 26, 2025

I mainly did this as it was low hanging fruit, I don't have a specific example where this happens.

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.

4 participants