File tree Expand file tree Collapse file tree 3 files changed +8
-1
lines changed Expand file tree Collapse file tree 3 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -130,9 +130,10 @@ pub trait Iterator {
130130 ///
131131 /// ```
132132 /// // an infinite iterator has no upper bound
133+ /// // and the maximum possible lower bound
133134 /// let iter = 0..;
134135 ///
135- /// assert_eq!((0 , None), iter.size_hint());
136+ /// assert_eq!((usize::max_value() , None), iter.size_hint());
136137 /// ```
137138 #[ inline]
138139 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
Original file line number Diff line number Diff line change @@ -543,6 +543,11 @@ impl<A: Step> Iterator for ops::RangeFrom<A> where
543543 mem:: swap ( & mut n, & mut self . start ) ;
544544 Some ( n)
545545 }
546+
547+ #[ inline]
548+ fn size_hint ( & self ) -> ( usize , Option < usize > ) {
549+ ( usize:: MAX , None )
550+ }
546551}
547552
548553#[ unstable( feature = "fused" , issue = "35602" ) ]
Original file line number Diff line number Diff line change @@ -764,6 +764,7 @@ fn test_iterator_size_hint() {
764764 let v2 = & [ 10 , 11 , 12 ] ;
765765 let vi = v. iter ( ) ;
766766
767+ assert_eq ! ( ( 0 ..) . size_hint( ) , ( usize :: MAX , None ) ) ;
767768 assert_eq ! ( c. size_hint( ) , ( usize :: MAX , None ) ) ;
768769 assert_eq ! ( vi. clone( ) . size_hint( ) , ( 10 , Some ( 10 ) ) ) ;
769770
You can’t perform that action at this time.
0 commit comments