diff options
| author | bors <bors@rust-lang.org> | 2021-11-27 22:53:21 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-11-27 22:53:21 +0000 |
| commit | 4919988fe1765e51232558647f2260fff3544658 (patch) | |
| tree | 554ebba313dcecb155969556feffbb8b239bd4a6 /compiler/rustc_mir_transform/src/coverage/mod.rs | |
| parent | 686e313a9aa14107c8631ffe48fa09110a7692db (diff) | |
| parent | 9125dd74bdbd0c41d6f8341366992db514e56246 (diff) | |
| download | rust-4919988fe1765e51232558647f2260fff3544658.tar.gz rust-4919988fe1765e51232558647f2260fff3544658.zip | |
Auto merge of #91241 - dtolnay:firstchunk, r=oli-obk
Eliminate an unreachable codepath from String::from_utf8_lossy `Utf8Lossy`'s `Iterator` implementation ensures that only the **final** chunk has an empty slice for `broken`: https://github.com/rust-lang/rust/blob/dd549dcab404ec4c7d07b5a83aca5bdd7171138f/library/core/src/str/lossy.rs#L46-L47 Thus the only way the **first** chunk could have an empty `broken` is if it is the **final** chunk, i.e. there is only one chunk total. And the only way that there could be one chunk total with an empty `broken` is if the whole input is valid utf8 and non-empty. That condition has already been handled by an early return, so at the point that the first `REPLACEMENT` is being pushed, it's impossible for `first_broken` to be empty.
Diffstat (limited to 'compiler/rustc_mir_transform/src/coverage/mod.rs')
0 files changed, 0 insertions, 0 deletions
