3 ms·
As an example of this: https://doc.rust-lang.org/stable/std/iter/index.html#for-loops-and-intoiterator https://doc.rust-lang.org/stable/std/iter/index.html#for-
by steveklabnik 6y ago
As an example of this: https://doc.rust-lang.org/stable/std/iter/index.html#for-loops-and-intoiterator https://doc.rust-lang.org/stable/std/iter/index.html#for-loo...
- tom_mellior 6y agoI don't see iterator syntax being desugared to a counted loop there. I don't doubt that the Rust compiler eventually produces a counted loop when iterating over a vector, but this link doesn't demonstrate that.
- steveklabnik 6y agoIt’s not a counted loop, it’s true. for loops are sugar for iterators and an infinite loop + break. My point is that it is not a particularly complex transformation, as you said. I thought the complexity (or lack thereof) was the high order bit. Sorry I should have been more clear!