Skip to content

Commit 7bb153c

Browse files
committed
Merge branch 'master' of github.com:rust-lang/rfcs
2 parents 12cba3a + 8428b05 commit 7bb153c

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

text/1581-fused-iterator.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,12 @@ impl<I> Iterator for Fuse<I> where I: FusedIterator {
190190
3. Fuse isn't used very often anyways. However, I would argue that it should be
191191
used more often and people are just playing fast and loose. I'm hoping that
192192
making `Fuse` free when unneeded will encourage people to use it when they should.
193+
4. This trait locks implementors into following the `FusedIterator` spec;
194+
removing the `FusedIterator` implementation would be a breaking change. This
195+
precludes future optimizations that take advantage of the fact that the
196+
behavior of an `Iterator` is undefined after it returns `None` the first
197+
time.
198+
193199

194200
# Alternatives
195201

@@ -268,9 +274,11 @@ change.
268274
[unresolved]: #unresolved-questions
269275

270276
Should this trait be unsafe? I can't think of any way generic unsafe code could
271-
end up relying on the guarantees of `Fused`.
277+
end up relying on the guarantees of `FusedIterator`.
272278

273-
Also, it's possible to implement the specialized `Fuse` struct without a useless
274-
`don` bool. Unfortunately, it's *very* messy. IMO, this is not worth it for now
279+
~~Also, it's possible to implement the specialized `Fuse` struct without a useless
280+
`done` bool. Unfortunately, it's *very* messy. IMO, this is not worth it for now
275281
and can always be fixed in the future as it doesn't change the `FusedIterator`
276-
trait.
282+
trait.~~ Resolved: It's not possible to remove the `done` bool without making
283+
`Fuse` invariant.
284+

0 commit comments

Comments
 (0)