Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upChain has an incorrect implementation of DoubleEndedIterator #26316
Comments
This comment has been minimized.
This comment has been minimized.
|
|
This comment has been minimized.
This comment has been minimized.
|
Specifically for any Iterator, you can call Nothing else is guaranteed. Chain is incorrectly implemented as:
It should use the same strategy as |
Gankro
changed the title
DoubleEndedIterator should explicitly document what happens after None is returned
Chain has an incorrect implementation of DoubleEndedIterator
Jun 15, 2015
Gankro
added
A-libs
P-low
labels
Jun 15, 2015
This comment has been minimized.
This comment has been minimized.
|
Just using Of course, putting the flags inside the chain struct itself is an optimization (packs the members better). |
This comment has been minimized.
This comment has been minimized.
|
This is true (spoil-sport! :P) |
eefriedman commentedJun 15, 2015
Testcase:
gives:
I'm pretty sure CrazyIterator isn't a legitimate implementation of DoubleEndedIterator, but the documentation doesn't say that explicitly, and it explicitly states that this is a legitimate implementation of Iterator. (If this is supposed to be allowed, std::iter::Chain has a bug.)