rust/library/core
bors 4514fb98d5 Auto merge of #112229 - clarfonthey:range-iter-count, r=dtolnay
Specialize count for range iterators

Since `size_hint` is already specialized, it feels apt to specialize `count` as well. Without any specialized version of `ExactSizeIterator::len` or `Step::steps_between`, this feels like a more reliable way of accessing this without having to rely on knowing that `size_hint` is correct.

In my case, this is particularly useful to access the `steps_between` implementation for `char` from the standard library without having to compute it manually.

I didn't think it was worth modifying the `Step` trait to add a version of `steps_between` that used native overflow checks since this is just doing one subtraction in most cases anyway, and so I decided to make the inclusive version use `checked_add` so it didn't have this lopsided overflow-checks-but-only-sometimes logic.
2023-09-16 16:43:31 +00:00
..
benches fix 2023-07-23 09:58:31 +00:00
primitive_docs Add primitive documentation to libcore 2021-09-12 02:23:08 +00:00
src Auto merge of #112229 - clarfonthey:range-iter-count, r=dtolnay 2023-09-16 16:43:31 +00:00
tests Auto merge of #113295 - clarfonthey:ascii-step, r=cuviper 2023-09-02 00:02:50 +00:00
Cargo.toml Update rand in the stdlib tests, and remove the getrandom feature from it 2023-01-04 14:52:41 -08:00