-
Notifications
You must be signed in to change notification settings - Fork 13.4k
IteratorExt::rev should be bounded by DoubleEndedIterator #23587
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
That's not the problematic error, this is: error: type `core::iter::Rev<core::iter::StepBy<_, core::ops::Range<_>>>` does not implement any method in scope named `next`
(0..10).step_by(2).rev().next();
^~~~~~ |
Merged
This is basically the same as #23588 |
They are two different issues. Bounding IteratorExt::rev by DoubleEndedIterator won't make using rev() on the result of step_by() possible. |
Yeah, just noting the link :) |
aturon
added a commit
to aturon/rust
that referenced
this issue
Apr 9, 2015
This commit changes `Iterator`'s API by: * Generalizing bounds from `Iterator` to `IntoIterator` whenever possible, matching the semantics and ergonomics of `for` loops. * Tightens up a few method-level bounds so that you get an error earlier. For example, `rev` did not require `DoubleEndedIterator` even though the result is only an `Iterator` when the original iterator was double-ended. Closes rust-lang#23587 The bound-tightening is technically a: [breaking-change] but no code should break in practice.
Manishearth
added a commit
to Manishearth/rust
that referenced
this issue
Apr 9, 2015
This commit changes `Iterator`'s API by: * Generalizing bounds from `Iterator` to `IntoIterator` whenever possible, matching the semantics and ergonomics of `for` loops. * Tightens up a few method-level bounds so that you get an error earlier. For example, `rev` did not require `DoubleEndedIterator` even though the result is only an `Iterator` when the original iterator was double-ended. Closes rust-lang#23587 The bound-tightening is technically a: [breaking-change] but no code should break in practice. r? @alexcrichton cc @Kimundi
aturon
added a commit
to aturon/rust
that referenced
this issue
Apr 9, 2015
This commit changes `Iterator`'s API by: * Generalizing bounds from `Iterator` to `IntoIterator` whenever possible, matching the semantics and ergonomics of `for` loops. * Tightens up a few method-level bounds so that you get an error earlier. For example, `rev` did not require `DoubleEndedIterator` even though the result is only an `Iterator` when the original iterator was double-ended. Closes rust-lang#23587 The bound-tightening is technically a: [breaking-change] but no code should break in practice.
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
produces the following error:
According to @eddyb,
IteratorExt::rev
should be bounded byDoubleEndedIterator
to prevent this.EDIT: Updated the example to show the correct error.
The text was updated successfully, but these errors were encountered: