Zip
implementation optimization using TrustedRandomAccess
can remove observable side-effects.
#85890
Labels
A-iterators
Area: Iterators
C-bug
Category: This is a bug.
T-libs
Relevant to the library team, which will review and decide on the PR/issue.
(playground)
This is a flaw in the current specialized implementation of
next()
.This implementation makes sure to keep trying to evaluate the first iterator in the
Zip
like the short-circuiting default implementationHowever, the default implementation does it differently: It keeps polling the first iterator even if it’s empty as indicated by its
size_hint
, whereas theTrustedRandomAccess
-using implementation stops as soon as the first iterator is known to be empty based on size calculations.@rustbot label T-libs-impl, A-iterators
The text was updated successfully, but these errors were encountered: