Improve size_hint bounds for DecodeUtf16 iterator#88763
Closed
steffahn wants to merge 2 commits intorust-lang:masterfrom
Closed
Improve size_hint bounds for DecodeUtf16 iterator#88763steffahn wants to merge 2 commits intorust-lang:masterfrom
size_hint bounds for DecodeUtf16 iterator#88763steffahn wants to merge 2 commits intorust-lang:masterfrom
Conversation
Contributor
|
r? @scottmcm (rust-highfive has picked a reviewer for you, use r? to override) |
Member
Author
|
There’s the option of also inspecting |
658184c to
fa5e283
Compare
Member
Author
|
Also missing tests. I’m going to create an alternative version that does inspect @rustbot label S-waiting-on-author -S-waiting-on-review |
Member
Author
|
Member
|
@steffahn Ping from triage, any updates on this? |
Member
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this pull request
Jan 30, 2022
…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
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this pull request
Jan 31, 2022
…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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
If at most 2
u16s make up one item in the iterator, then there has to be a minimum oflen + 1 / 2elements 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.