about summary refs log tree commit diff
path: root/library/std/src
diff options
context:
space:
mode:
authorBenoît du Garreau <bdgdlm@outlook.com>2024-01-31 11:05:41 +0100
committerBenoît du Garreau <bdgdlm@outlook.com>2024-01-31 11:06:19 +0100
commita158fb33effaee88bfce664a4dd201c61ff4bb10 (patch)
tree3b460d092ff588d518b20c4942fd639beee53b9d /library/std/src
parentcdaa12e3dff109f72a5a8a0a67ea225052122a79 (diff)
downloadrust-a158fb33effaee88bfce664a4dd201c61ff4bb10.tar.gz
rust-a158fb33effaee88bfce664a4dd201c61ff4bb10.zip
Improve `io::Read::read_buf_exact` error case
- Use `const_io_error` instead of `Error::new`
- Use the same message as `read_exact`
Diffstat (limited to 'library/std/src')
-rw-r--r--library/std/src/io/mod.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/library/std/src/io/mod.rs b/library/std/src/io/mod.rs
index 8fca66fa17c..ee79d47ddd9 100644
--- a/library/std/src/io/mod.rs
+++ b/library/std/src/io/mod.rs
@@ -994,7 +994,10 @@ pub trait Read {
             }
 
             if cursor.written() == prev_written {
-                return Err(Error::new(ErrorKind::UnexpectedEof, "failed to fill buffer"));
+                return Err(error::const_io_error!(
+                    ErrorKind::UnexpectedEof,
+                    "failed to fill whole buffer"
+                ));
             }
         }