-
Notifications
You must be signed in to change notification settings - Fork 628
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix issues with AsyncBufRead::read_line
and AsyncBufReadExt::lines
#2884
Conversation
AsyncBufRead::read_line
and AsyncBufReadExt::lines
Fixes the following issues in `AsyncBufRead::read_line`: * When the future is dropped the previous string contents are not restored so the string is empty. * If invalid UTF-8 is encountered the previous string contents are not restored. * If an IO error occurs after `read_until_internal` already read a couple of bytes a debug assertion fails. * Performance: The whole string to which read contents are appended is check for UTF-8 validity instead of just the added bytes. * Fixes the following issues in `AsyncBufRead::read_line` * If an IO error occurs after `read_until_internal` already read a couple of bytes a debug assertion fails. (rust-lang#2862) Fixes rust-lang#2862.
dc4720b
to
f7d3367
Compare
The miri error is caused by It happens even with this test on master: #[test]
fn read_until_eof_256() {
let mut r = Cursor::new(vec![b'x'; 256]);
let _ = block_on(r.read_until(b'\n', &mut Vec::new()));
} Or when running this through miri with fn main() {
let v=vec![b'x'; 256];
memchr::memchr(b'a', &v);
} Apparently we have not run into it before because our tests have short slices. Not sure what we want to do about it either. Ignore read_until-related tests for Miri or use a shorter length for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
#2884) Fixes the following issues in `AsyncBufRead::read_line`: * When the future is dropped the previous string contents are not restored so the string is empty. * If invalid UTF-8 is encountered the previous string contents are not restored. * If an IO error occurs after `read_until_internal` already read a couple of bytes a debug assertion fails. * Performance: The whole string to which read contents are appended is check for UTF-8 validity instead of just the added bytes. Fixes the following issues in `AsyncBufRead::read_line`: * If an IO error occurs after `read_until_internal` already read a couple of bytes a debug assertion fails. (#2862) Fixes #2862
#2884) Fixes the following issues in `AsyncBufRead::read_line`: * When the future is dropped the previous string contents are not restored so the string is empty. * If invalid UTF-8 is encountered the previous string contents are not restored. * If an IO error occurs after `read_until_internal` already read a couple of bytes a debug assertion fails. * Performance: The whole string to which read contents are appended is check for UTF-8 validity instead of just the added bytes. Fixes the following issues in `AsyncBufRead::read_line`: * If an IO error occurs after `read_until_internal` already read a couple of bytes a debug assertion fails. (#2862) Fixes #2862
#2884) Fixes the following issues in `AsyncBufRead::read_line`: * When the future is dropped the previous string contents are not restored so the string is empty. * If invalid UTF-8 is encountered the previous string contents are not restored. * If an IO error occurs after `read_until_internal` already read a couple of bytes a debug assertion fails. * Performance: The whole string to which read contents are appended is check for UTF-8 validity instead of just the added bytes. Fixes the following issues in `AsyncBufRead::read_line`: * If an IO error occurs after `read_until_internal` already read a couple of bytes a debug assertion fails. (#2862) Fixes #2862
Fixes the following issues in
AsyncBufRead::read_line
:read_until_internal
already read a couple of bytes a debug assertion fails.Fixes the following issues in
AsyncBufReadExt:lines
read_until_internal
already read a couple of bytes a debug assertion fails. (FixesLines::poll_next
panics if the reader returns an error after returning data #2862)Fixes #2862