about summary refs log tree commit diff
path: root/compiler/rustc_mir_transform/src/coverage/debug.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-09-16 16:43:31 +0000
committerbors <bors@rust-lang.org>2023-09-16 16:43:31 +0000
commit4514fb98d58eb0bcd65a16266875ef031c373cdf (patch)
treed0918179ff6a1ac4532a5e0edfadfd4605563e6e /compiler/rustc_mir_transform/src/coverage/debug.rs
parent409e7f6f21f9728fa1a4a277ed7d5618ba83cfb2 (diff)
parent08aa6c9b650ba83b58600d0794bcf0bc8eef7a42 (diff)
downloadrust-4514fb98d58eb0bcd65a16266875ef031c373cdf.tar.gz
rust-4514fb98d58eb0bcd65a16266875ef031c373cdf.zip
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.
Diffstat (limited to 'compiler/rustc_mir_transform/src/coverage/debug.rs')
0 files changed, 0 insertions, 0 deletions