-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Replace the current for
protocol with external iterators
#6997
Comments
Nominating for the backwards compatible milestone. This will change the |
Is there some reason you can't add an |
@bblum: they do have that with an |
Here's what it would do: // for loop sugar
for xs.take_while(|x| *x < 5).zip(ys) |(x, y)| { return x + y; }
// equivalent low-calorie code, already compiling today
let mut it = xs.take_while(|x| *x < 5).zip(ys);
loop {
match it.next() {
Some((x, y)) => return x + y, // note that this will always return successfully
None => break
}
} No more errors like this from
They'll also compile much faster than closures and avoid the noisy |
👍 👍 👍 👍 👍 |
fix `missing_panics_doc` not detecting `assert_eq!` and `assert_ne!` fixes rust-lang#6997 changelog: `missing_panics_doc` detects `assert_eq!` and `assert_ne!` --- searching for `assert_eq!` and `assert_ne!` in `FindPanicUnwrap`
The
std::iterator::Iterator
trait will need a lang item andIterator
implementations on functions will likely have to be forbidden to avoid ambiguity with internal iterators.The body of the loop won't have to be a closure and
return
/break
will never fail to work as expected.See: https://mail.mozilla.org/pipermail/rust-dev/2013-June/004364.html
The text was updated successfully, but these errors were encountered: