File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -1013,6 +1013,12 @@ impl<A: Step> Iterator for ops::RangeFrom<A> {
10131013
10141014 #[ inline]
10151015 fn next ( & mut self ) -> Option < A > {
1016+ #[ cfg( not( bootstrap) ) ]
1017+ if crate :: intrinsics:: overflow_checks ( ) {
1018+ self . start = Step :: forward ( self . start . clone ( ) , 1 ) ;
1019+ return Some ( self . start . clone ( ) ) ;
1020+ }
1021+
10161022 let n = Step :: forward ( self . start . clone ( ) , 1 ) ;
10171023 Some ( mem:: replace ( & mut self . start , n) )
10181024 }
@@ -1024,6 +1030,13 @@ impl<A: Step> Iterator for ops::RangeFrom<A> {
10241030
10251031 #[ inline]
10261032 fn nth ( & mut self , n : usize ) -> Option < A > {
1033+ #[ cfg( not( bootstrap) ) ]
1034+ if crate :: intrinsics:: overflow_checks ( ) {
1035+ let plus_n = Step :: forward ( self . start . clone ( ) , n) ;
1036+ self . start = Step :: forward ( plus_n. clone ( ) , 1 ) ;
1037+ return Some ( self . start . clone ( ) ) ;
1038+ }
1039+
10271040 let plus_n = Step :: forward ( self . start . clone ( ) , n) ;
10281041 self . start = Step :: forward ( plus_n. clone ( ) , 1 ) ;
10291042 Some ( plus_n)
You can’t perform that action at this time.
0 commit comments