diff --git a/base/essentials.jl b/base/essentials.jl index dd410b06cc8d9..d57ef023e6283 100644 --- a/base/essentials.jl +++ b/base/essentials.jl @@ -775,6 +775,13 @@ inferencebarrier(@nospecialize(x)) = Ref{Any}(x)[] Determine whether a collection is empty (has no elements). +!!! warning + + `isempty(itr)` may consume the next element of a stateful iterator `itr` + unless an appropriate `Base.isdone(itr)` or `isempty` method is defined. + Use of `isempty` should therefore be avoided when writing generic + code which should support any iterator type. + # Examples ```jldoctest julia> isempty([])