File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -666,7 +666,19 @@ pub trait FusedIterator: Iterator {}
666666#[ unstable( feature = "fused" , issue = "35602" ) ]
667667impl < ' a , I : FusedIterator + ?Sized > FusedIterator for & ' a mut I { }
668668
669- /// An iterator that has correct length
669+ /// An iterator that reports an accurate length using size_hint.
670+ ///
671+ /// The iterator reports a size hint where it is either exact
672+ /// (lower bound is equal to upper bound), or the upper bound is `None`.
673+ /// The upper bound must only be `None` if the actual iterator length is
674+ /// larger than `usize::MAX`.
675+ ///
676+ /// The iterator must produce exactly the number of elements it reported.
677+ ///
678+ /// # Safety
679+ ///
680+ /// This trait must only be implemented when the contract is upheld.
681+ /// Consumers of this trait must inspect `.size_hint()`’s upper bound.
670682#[ unstable( feature = "trusted_len" , issue = "0" ) ]
671683pub unsafe trait TrustedLen : Iterator { }
672684
You can’t perform that action at this time.
0 commit comments