std::iter::Skip::count
can overflow even if the iterator would return less that usize::max_value()
items
#68139
Labels
A-iterators
Area: Iterators
C-bug
Category: This is a bug.
regression-from-stable-to-stable
Performance or correctness regression from one stable version to another.
T-libs-api
Relevant to the library API team, which will review and decide on the PR/issue.
std::iter::Skip::count
currently callscount
on the inner iterator but that can overflow even if theSkip
itself doesn't return more thatusize::max_value()
items.For example:
This should return
10
but currently triggers anattempt to add with overflow
(or returns0
if overflow checks are disabled).This is caused by
rust/src/libcore/iter/adapters/mod.rs
Lines 1817 to 1820 in 1389494
The text was updated successfully, but these errors were encountered: