about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src/common.rs
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2021-12-14 20:47:26 +0100
committerGitHub <noreply@github.com>2021-12-14 20:47:26 +0100
commit50327d2c9169cb218834ee75db00f0b3a969c54c (patch)
treed68590fcae644e85abb03f04b073d2f4dca8d285 /compiler/rustc_codegen_llvm/src/common.rs
parent404c8471aba60c2d837fa728e7c729a0f52d5830 (diff)
parentf6e4c742f41c5505c9a371ce8ef2c7aed55c35e4 (diff)
downloadrust-50327d2c9169cb218834ee75db00f0b3a969c54c.tar.gz
rust-50327d2c9169cb218834ee75db00f0b3a969c54c.zip
Rollup merge of #89825 - martinvonz:split-inclusive-empty, r=m-ou-se
Make split_inclusive() on an empty slice yield an empty output

`[].split_inclusive()` currently yields a single, empty slice. That's
different from `"".split_inslusive()`, which yields no output at
all. I think that makes the slice version harder to use.

The case where I ran into this bug was when writing code for
generating a diff between two slices of bytes. I wanted to prefix
removed lines with "-" and a added lines with "+". Due to
`split_inclusive()`'s current behavior, that means that my code prints
just a "-" or "+" for empty files. I suspect most existing callers
have similar "bugs" (which would be fixed by this patch).

Closes #89716.
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/common.rs')
0 files changed, 0 insertions, 0 deletions