Commit 75ac95b
Only implement FusedIterator for TakeWhileInclusive when the inner iterator is fused
TakeWhileInclusive sets its `done` flag only when the predicate rejects an
element, not when the inner iterator returns None. With a non-fused inner
iterator it can therefore yield Some after returning None, which breaks the
FusedIterator contract it currently claims for every Iterator.
Bound the impl on `I: FusedIterator`, matching std::iter::TakeWhile.
Fixes #10881 parent 37bd72a commit 75ac95b
2 files changed
Lines changed: 7 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
93 | | - | |
| 93 | + | |
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1986 | 1986 | | |
1987 | 1987 | | |
1988 | 1988 | | |
| 1989 | + | |
| 1990 | + | |
| 1991 | + | |
| 1992 | + | |
| 1993 | + | |
| 1994 | + | |
1989 | 1995 | | |
1990 | 1996 | | |
1991 | 1997 | | |
| |||
0 commit comments