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 @@ -1014,6 +1014,12 @@ impl<A: Step> Iterator for ops::RangeFrom<A> {
10141014
10151015 #[ inline]
10161016 fn next ( & mut self ) -> Option < A > {
1017+ #[ cfg( not( bootstrap) ) ]
1018+ if crate :: intrinsics:: overflow_checks ( ) {
1019+ self . start = Step :: forward ( self . start . clone ( ) , 1 ) ;
1020+ return Some ( self . start . clone ( ) ) ;
1021+ }
1022+
10171023 let n = Step :: forward ( self . start . clone ( ) , 1 ) ;
10181024 Some ( mem:: replace ( & mut self . start , n) )
10191025 }
@@ -1025,6 +1031,13 @@ impl<A: Step> Iterator for ops::RangeFrom<A> {
10251031
10261032 #[ inline]
10271033 fn nth ( & mut self , n : usize ) -> Option < A > {
1034+ #[ cfg( not( bootstrap) ) ]
1035+ if crate :: intrinsics:: overflow_checks ( ) {
1036+ let plus_n = Step :: forward ( self . start . clone ( ) , n) ;
1037+ self . start = Step :: forward ( plus_n. clone ( ) , 1 ) ;
1038+ return Some ( self . start . clone ( ) ) ;
1039+ }
1040+
10281041 let plus_n = Step :: forward ( self . start . clone ( ) , n) ;
10291042 self . start = Step :: forward ( plus_n. clone ( ) , 1 ) ;
10301043 Some ( plus_n)
You can’t perform that action at this time.
0 commit comments