rust/library
Matthias Krüger 50327d2c91
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.
2021-12-14 20:47:26 +01:00
..
alloc Rollup merge of #89825 - martinvonz:split-inclusive-empty, r=m-ou-se 2021-12-14 20:47:26 +01:00
backtrace@b02ed04a7e
core Rollup merge of #89825 - martinvonz:split-inclusive-empty, r=m-ou-se 2021-12-14 20:47:26 +01:00
panic_abort
panic_unwind
portable-simd Merge commit 'a8385522ade6f67853edac730b5bf164ddb298fd' into simd-remove-autosplats 2021-12-02 18:27:47 -08:00
proc_macro
profiler_builtins
rtstartup
rustc-std-workspace-alloc
rustc-std-workspace-core
rustc-std-workspace-std
std Stabilize const_cstr_unchecked 2021-12-13 08:43:19 +01:00
stdarch@b70ae88ef2 Update stdarch dependency 2021-12-09 22:33:25 +08:00
test
unwind Android: -ldl must appear after -lgcc when linking 2021-11-30 02:42:35 +00:00