We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
read_buf_exact
1 parent 65b5d76 commit 199f308Copy full SHA for 199f308
library/std/src/io/mod.rs
@@ -1278,6 +1278,8 @@ pub trait Read {
1278
let mut buf = [MaybeUninit::uninit(); N];
1279
let mut borrowed_buf = BorrowedBuf::from(buf.as_mut_slice());
1280
self.read_buf_exact(borrowed_buf.unfilled())?;
1281
+ // Guard against incorrect `read_buf_exact` implementations.
1282
+ assert_eq!(borrowed_buf.len(), N);
1283
Ok(unsafe { MaybeUninit::array_assume_init(buf) })
1284
}
1285
0 commit comments