You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
library: core::str::lines: Fix handling of trailing bare CR
E.g., split "bare\r" into the single line "bare\r", not "bare".
The documentation for this function says that only LF or CR-LF count
as newlines. So a bare CR is not a line ending, and must not be
stripped.
This fix is a behavioural change, even though it brings the behaviour
into line with the documentation, and into line with that of
`std::io::BufRead:;lines()`.
It seems unlikely that anyone is relying on this bug, but I'm not sure
how to rule it out. Perhaps this should have an FCP or a crater run or
something. It should definitely be in the release notes.
This is an alternative to rust-lang#91051, which proposes to document rather
than fix the behaviour.
As for the implementation: the current version doesn't give the map
closure the right information, so we need to use split_inclusive.
After that, we can reuse the logic in the new `str::trim_newline`.
Signed-off-by: Ian Jackson <[email protected]>
0 commit comments