switch Option to external iterators #7055
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This was a lot more painful than just changing
x.each
tox.iter().advance
. I ran into my old friend #5898 and had to add underscores to some method names as a temporary workaround.The borrow checker also had other ideas because rvalues aren't handled very well yet so temporary variables had to be added. However, storing the temporary in a variable led to dynamic
@mut
failures, so those had to be wrapped in blocks except where the scope ends immediately.Anyway, the ugliness will be fixed as the compiler issues are fixed and this change will amount to
for x.each |x|
becomingfor x.iter |x|
and making all the iterator adaptors available.I dropped the run-pass tests for
old_iter
because there's not much point in fixing a module that's on the way out in the next week or so.