-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Avoid overflow in std::iter::Skip::count
#68469
Conversation
The call to `count` on the inner iterator can overflow even if `Skip` itself would return less that `usize::max_value()` items.
r? @sfackler (rust_highfive has picked a reviewer for you, use r? to override) |
Won't this return a wrong value whenever |
It looks correct to me. In that example it will call |
@bors r+ |
📌 Commit 9d3e844 has been approved by |
Huh yeah, not sure what I was thinking yesterday. |
Avoid overflow in `std::iter::Skip::count` The call to `count` on the inner iterator can overflow even if `Skip` itself would return less that `usize::max_value()` items. Fixes rust-lang#68139
Avoid overflow in `std::iter::Skip::count` The call to `count` on the inner iterator can overflow even if `Skip` itself would return less that `usize::max_value()` items. Fixes rust-lang#68139
Rollup of 7 pull requests Successful merges: - #68424 (Suggest borrowing `Vec<NonCopy>` in for loop) - #68438 (Account for non-types in substs for opaque type error messages) - #68469 (Avoid overflow in `std::iter::Skip::count`) - #68473 (Enable ASan on Fuchsia) - #68479 (Implement `unused_parens` for block return values) - #68483 (Add my (@flip1995) name to .mailmap) - #68500 (Clear out std, not std tools) Failed merges: r? @ghost
The call to
count
on the inner iterator can overflow even ifSkip
itself would return less thatusize::max_value()
items.Fixes #68139