Skip to content

Commit a3ea647

Browse files
authored
Rollup merge of #120523 - a1phyr:improve_read_buf_exact, r=the8472
Improve `io::Read::read_buf_exact` error case - Use `const_io_error` instead of `Error::new` - Use the same message as `read_exact`
2 parents ceeaa8a + a158fb3 commit a3ea647

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

library/std/src/io/mod.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -994,7 +994,10 @@ pub trait Read {
994994
}
995995

996996
if cursor.written() == prev_written {
997-
return Err(Error::new(ErrorKind::UnexpectedEof, "failed to fill buffer"));
997+
return Err(error::const_io_error!(
998+
ErrorKind::UnexpectedEof,
999+
"failed to fill whole buffer"
1000+
));
9981001
}
9991002
}
10001003

0 commit comments

Comments
 (0)