Skip to content

Commit f578f84

Browse files
authored
Rollup merge of rust-lang#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 58ba7c6 + fa9df69 commit f578f84

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

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)