rust/library/core
许杰友 Jieyou Xu (Joe) 01bc95417c
Rollup merge of #138329 - scottmcm:assert-hint, r=Mark-Simulacrum
debug-assert that the size_hint is well-formed in `collect`

Closes #137919

In the hopes of helping to catch any future accidentally-incorrect rustc or stdlib iterators (like the ones #137908 accidentally found), this has `Iterator::collect` call `size_hint` and check its `low` doesn't exceed its `Some(high)`.

There's of course a bazillion more places this *could* be checked, but the hope is that this one is a good tradeoff of being likely to catch lots of things while having minimal maintenance cost (especially compared to putting it in *every* container's `from_iter`).
2025-03-16 09:40:07 +08:00
..
src Rollup merge of #138329 - scottmcm:assert-hint, r=Mark-Simulacrum 2025-03-16 09:40:07 +08:00
Cargo.toml Migrate core to Rust 2024 2025-03-11 09:46:34 -07:00