-
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
Using Zip & Take allows accessing the middle a Map iterator without “getting there first” from either side. #85969
Comments
cc @the8472 |
Edit: Nevermind, not really since it doesn't involve calling |
It’s related to #82303. I guess the “random” aspect of You can do the same thing (accessing the let mut y = iterator.zip(0..51).zip(0..100);
y.next_back(); This issue is only “really” a regression if out-of-order side-effects for iterators aren’t wanted. |
steffahn brought up some general concerns about the I am generally in favor of eliminating iterator side-effects that are not necessary to produce the final results. But of course that's currently undocumented and possibly surprising behavior and needs to be approved by the libs team, which hasn't happened so far. So while I like what it does it shouldn't have landed without discussion.
I don't think so? At least that would be another implementation gap. That's what the whole let mut y = iterator.zip(0..51).zip(0..100);
y.next_back(); Oh, sure, that definitely is #82303 |
I'll submit a revert PR. |
Look at this iterator.
We all know that when
map
’s resultingIterator
implementsDoubleEndedIterator
, then the side-effects can be re-ordered. However, judging by the implementation ofmap
one would probably at least expect that it’s impossible to hit the"item 50"
without first either going through at least0, 1, 2, … 49
or100, 99, 98, … 51
first. Right?Well, here we go!
on beta
on stable 1.52.0
(playground)
@rustbot label T-libs-impl, A-iterators, A-specialization, regression-from-stable-to-beta
The text was updated successfully, but these errors were encountered: