File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -1014,6 +1014,11 @@ impl<A: Step> Iterator for ops::RangeFrom<A> {
1014
1014
1015
1015
#[ inline]
1016
1016
fn next ( & mut self ) -> Option < A > {
1017
+ if crate :: intrinsics:: overflow_checks ( ) {
1018
+ self . start = Step :: forward ( self . start . clone ( ) , 1 ) ;
1019
+ return Some ( self . start . clone ( ) ) ;
1020
+ }
1021
+
1017
1022
let n = Step :: forward ( self . start . clone ( ) , 1 ) ;
1018
1023
Some ( mem:: replace ( & mut self . start , n) )
1019
1024
}
@@ -1025,6 +1030,12 @@ impl<A: Step> Iterator for ops::RangeFrom<A> {
1025
1030
1026
1031
#[ inline]
1027
1032
fn nth ( & mut self , n : usize ) -> Option < A > {
1033
+ if crate :: intrinsics:: overflow_checks ( ) {
1034
+ let plus_n = Step :: forward ( self . start . clone ( ) , n) ;
1035
+ self . start = Step :: forward ( plus_n. clone ( ) , 1 ) ;
1036
+ return Some ( self . start . clone ( ) ) ;
1037
+ }
1038
+
1028
1039
let plus_n = Step :: forward ( self . start . clone ( ) , n) ;
1029
1040
self . start = Step :: forward ( plus_n. clone ( ) , 1 ) ;
1030
1041
Some ( plus_n)
You can’t perform that action at this time.
0 commit comments