We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3f9bac5 commit 6667f1bCopy full SHA for 6667f1b
futures-util/src/io/read_line.rs
@@ -35,6 +35,7 @@ pub(super) fn read_line_internal<R: AsyncBufRead + ?Sized>(
35
) -> Poll<io::Result<usize>> {
36
let ret = ready!(read_until_internal(reader, cx, b'\n', bytes, read));
37
if str::from_utf8(bytes).is_err() {
38
+ bytes.clear();
39
Poll::Ready(ret.and_then(|_| {
40
Err(io::Error::new(io::ErrorKind::InvalidData, "stream did not contain valid UTF-8"))
41
}))
0 commit comments