about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2021-04-01 07:55:00 +0000
committerbors <bors@rust-lang.org>2021-04-01 07:55:00 +0000
commit803ddb83598838fb9de308d283b759ba463e5e80 (patch)
treeed7c809ab360f62fe6f9dcb5336813d50b2665ce /compiler/rustc_codegen_llvm/src
parent49e1ec09952c5ab7798addd29532d44dc020283f (diff)
parentad3a791e2a8c0300090fa73d4ce414a738346a41 (diff)
downloadrust-803ddb83598838fb9de308d283b759ba463e5e80.tar.gz
rust-803ddb83598838fb9de308d283b759ba463e5e80.zip
Auto merge of #83726 - the8472:large-trustedlen-fail-fast, r=kennytm
panic early when `TrustedLen` indicates a `length > usize::MAX`

Changes `TrustedLen` specializations to immediately panic when `size_hint().1 == None`.

As far as I can tell this is ~not a change~ a minimal change in observable behavior for anything except ZSTs because the fallback path would go through `extend_desugared()` which tries to `reserve(lower_bound)` which already is `usize::MAX` and that would also lead to a panic. Before it might have popped somewhere between zero and a few elements from the iterator before panicking while it now panics immediately.

Overall this should reduce codegen by eliminating the fallback paths.

While looking into the `with_capacity()` behavior I also noticed that its documentation didn't have a *Panics* section, so I added that.
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
0 files changed, 0 insertions, 0 deletions