-
-
Notifications
You must be signed in to change notification settings - Fork 14.3k
Better handle when trying to iterate on a Range of a type that isn't Step
#151036
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
b377155 to
89713fc
Compare
|
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. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
r=me with tests blessed
| error[E0277]: `std::ops::Range<T>` is not an iterator | ||
| --> missing-bound.rs:2:14 | ||
| | | ||
| 2 | for _ in t {} | ||
| | ^ the trait `Step` is not implemented for `T` | ||
| | ^ not an iterator | ||
| | | ||
| = note: `Range` only implements `Iterator` for select types in the standard library, particularly integers; to see the full list of types, see the documentation for the unstable `Step` trait | ||
| = note: required for `std::ops::Range<T>` to implement `Iterator` | ||
| = note: required for `std::ops::Range<T>` to implement `IntoIterator` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This tells me that we're missing a path for displaying the original label as a note, like we do in many other cases. Pre-existing.
| | ^^^^^^^^^^^ the trait `Step` is not implemented for `bool` | ||
| | ^^^^^^^^^^^ not an iterator | ||
| | | ||
| = help: the nightly-only, unstable trait `Step` is not implemented for `bool` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the note that I would have expected to see in the other case.
This comment has been minimized.
This comment has been minimized.
5bd45b1 to
1fe705c
Compare
|
@bors r=mati865 |
Mention when a trait bound corresponds to an unstable trait.
Mention
RangewhenStepbound is unment, and explain that only some std types implIteratorforRange.CC #151026