-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Improve size_hint
bounds for DecodeUtf16
iterator
#88763
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
r? @scottmcm (rust-highfive has picked a reviewer for you, use r? to override) |
There’s the option of also inspecting |
658184c
to
fa5e283
Compare
Also missing tests. I’m going to create an alternative version that does inspect @rustbot label S-waiting-on-author -S-waiting-on-review |
|
@steffahn Ping from triage, any updates on this? |
…16_size_hint, r=dtolnay Make `char::DecodeUtf16::size_hist` more precise New implementation takes into account contents of `self.buf` and rounds lower bound up instead of down. Fixes rust-lang#88762 Revival of rust-lang#88763
…16_size_hint, r=dtolnay Make `char::DecodeUtf16::size_hist` more precise New implementation takes into account contents of `self.buf` and rounds lower bound up instead of down. Fixes rust-lang#88762 Revival of rust-lang#88763
If at most 2
u16
s make up one item in the iterator, then there has to be a minimum oflen + 1 / 2
elements for an odd-numbered iterator. In other words, the best lower bound would be determined by rounding up.Edit: I noticed #88762 while creating a PR including just bea5cd1. So now, I’ve added a commit that fixes #88762 as-well.