@@ -110,7 +110,7 @@ enumerate(iter) = Enumerate(iter)
110
110
length (e:: Enumerate ) = length (e. itr)
111
111
size (e:: Enumerate ) = size (e. itr)
112
112
@inline start (e:: Enumerate ) = (1 , start (e. itr))
113
- @inline function next (e:: Enumerate , state)
113
+ @propagate_inbounds function next (e:: Enumerate , state)
114
114
n = next (e. itr,state[2 ])
115
115
(state[1 ],n[1 ]), (state[1 ]+ 1 ,n[2 ])
116
116
end
@@ -225,7 +225,7 @@ size(z::Zip1) = size(z.a)
225
225
indices (z:: Zip1 ) = indices (z. a)
226
226
eltype (:: Type{Zip1{I}} ) where {I} = Tuple{eltype (I)}
227
227
@inline start (z:: Zip1 ) = start (z. a)
228
- @inline function next (z:: Zip1 , st)
228
+ @propagate_inbounds function next (z:: Zip1 , st)
229
229
n = next (z. a,st)
230
230
return ((n[1 ],), n[2 ])
231
231
end
@@ -244,7 +244,7 @@ size(z::Zip2) = promote_shape(size(z.a), size(z.b))
244
244
indices (z:: Zip2 ) = promote_shape (indices (z. a), indices (z. b))
245
245
eltype (:: Type{Zip2{I1,I2}} ) where {I1,I2} = Tuple{eltype (I1), eltype (I2)}
246
246
@inline start (z:: Zip2 ) = (start (z. a), start (z. b))
247
- @inline function next (z:: Zip2 , st)
247
+ @propagate_inbounds function next (z:: Zip2 , st)
248
248
n1 = next (z. a,st[1 ])
249
249
n2 = next (z. b,st[2 ])
250
250
return ((n1[1 ], n2[1 ]), (n1[2 ], n2[2 ]))
@@ -294,7 +294,7 @@ size(z::Zip) = promote_shape(size(z.a), size(z.z))
294
294
indices (z:: Zip ) = promote_shape (indices (z. a), indices (z. z))
295
295
eltype (:: Type{Zip{I,Z}} ) where {I,Z} = tuple_type_cons (eltype (I), eltype (Z))
296
296
@inline start (z:: Zip ) = tuple (start (z. a), start (z. z))
297
- @inline function next (z:: Zip , st)
297
+ @propagate_inbounds function next (z:: Zip , st)
298
298
n1 = next (z. a, st[1 ])
299
299
n2 = next (z. z, st[2 ])
300
300
(tuple (n1[1 ], n2[1 ]. .. ), (n1[2 ], n2[2 ]))
@@ -401,7 +401,7 @@ julia> collect(Iterators.rest([1,2,3,4], 2))
401
401
rest (itr,state) = Rest (itr,state)
402
402
403
403
start (i:: Rest ) = i. st
404
- next (i:: Rest , st) = next (i. itr, st)
404
+ @propagate_inbounds next (i:: Rest , st) = next (i. itr, st)
405
405
done (i:: Rest , st) = done (i. itr, st)
406
406
407
407
eltype (:: Type{Rest{I}} ) where {I} = eltype (I)
@@ -490,7 +490,7 @@ length(t::Take) = _min_length(t.xs, 1:t.n, iteratorsize(t.xs), HasLength())
490
490
491
491
start (it:: Take ) = (it. n, start (it. xs))
492
492
493
- function next (it:: Take , state)
493
+ @propagate_inbounds function next (it:: Take , state)
494
494
n, xs_state = state
495
495
v, xs_state = next (it. xs, xs_state)
496
496
return v, (n - 1 , xs_state)
@@ -557,7 +557,7 @@ function start(it::Drop)
557
557
xs_state
558
558
end
559
559
560
- next (it:: Drop , state) = next (it. xs, state)
560
+ @propagate_inbounds next (it:: Drop , state) = next (it. xs, state)
561
561
done (it:: Drop , state) = done (it. xs, state)
562
562
563
563
# Cycle an iterator forever
@@ -833,7 +833,7 @@ function start(f::Flatten)
833
833
return s, inner, s2
834
834
end
835
835
836
- @inline function next (f:: Flatten , state)
836
+ @propagate_inbounds function next (f:: Flatten , state)
837
837
s, inner, s2 = state
838
838
val, s2 = next (inner, s2)
839
839
while done (inner, s2) && ! done (f. it, s)
0 commit comments