Rollup merge of #84489 - amorison:issue-83969-fix, r=yaahc

Mention FusedIterator case in Iterator::fuse doc

Using `fuse` on an iterator that incorrectly implements
`FusedIterator` does not fuse the iterator. This commit adds a
note about this in the documentation of this method to increase
awareness about this potential issue (esp. when relying on fuse
in unsafe code).

Closes #83969
This commit is contained in:
Yuki Okushi 2021-04-24 12:17:09 +09:00 committed by GitHub
commit ed991a36b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1495,7 +1495,12 @@ fn flatten(self) -> Flatten<Self>
/// [`Some(T)`] again. `fuse()` adapts an iterator, ensuring that after a
/// [`None`] is given, it will always return [`None`] forever.
///
/// Note that the [`Fuse`] wrapper is a no-op on iterators that implement
/// the [`FusedIterator`] trait. `fuse()` may therefore behave incorrectly
/// if the [`FusedIterator`] trait is improperly implemented.
///
/// [`Some(T)`]: Some
/// [`FusedIterator`]: crate::iter::FusedIterator
///
/// # Examples
///