diff options
| author | Martin von Zweigbergk <martinvonz@google.com> | 2021-10-11 16:40:16 -0700 |
|---|---|---|
| committer | Martin von Zweigbergk <martinvonz@google.com> | 2021-10-12 08:34:03 -0700 |
| commit | f6e4c742f41c5505c9a371ce8ef2c7aed55c35e4 (patch) | |
| tree | 026d5aa2214d02c3dee3ac08cbd520de4a1d75fe /compiler/rustc_codegen_llvm/src/common.rs | |
| parent | 1067e2ca5e9cfe5c79f956e49ffc684c5142d49b (diff) | |
| download | rust-f6e4c742f41c5505c9a371ce8ef2c7aed55c35e4.tar.gz rust-f6e4c742f41c5505c9a371ce8ef2c7aed55c35e4.zip | |
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
