diff options
| author | bors <bors@rust-lang.org> | 2025-02-13 02:13:24 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2025-02-13 02:13:24 +0000 |
| commit | 9fcc9cf4a202aadfe1f44722b39c83536eba3dba (patch) | |
| tree | 4af2d23be4f10713dd414dbbb0848093f0223c3b /library/std/src/io/util.rs | |
| parent | 6dce9f8c2d8dde4c9ea20bab981cd70229c37fdc (diff) | |
| parent | d16b067f8cad5c006e967ad030c4ca4a33602966 (diff) | |
| download | rust-9fcc9cf4a202aadfe1f44722b39c83536eba3dba.tar.gz rust-9fcc9cf4a202aadfe1f44722b39c83536eba3dba.zip | |
Auto merge of #136954 - jhpratt:rollup-koefsot, r=jhpratt
Rollup of 12 pull requests Successful merges: - #134090 (Stabilize target_feature_11) - #135025 (Cast allocas to default address space) - #135841 (Reject `?Trait` bounds in various places where we unconditionally warned since 1.0) - #136217 (Mark condition/carry bit as clobbered in C-SKY inline assembly) - #136699 (std: replace the `FromInner` implementation for addresses with private conversion functions) - #136806 (Fix cycle when debug-printing opaque types from RPITIT) - #136807 (compiler: internally merge `PtxKernel` into `GpuKernel`) - #136818 (Implement `read*_exact` for `std:io::repeat`) - #136927 (Correctly escape hashtags when running `invalid_rust_codeblocks` lint) - #136937 (Update books) - #136945 (Add diagnostic item for `std::io::BufRead`) - #136947 (Reinstate nnethercote in the review rotation.) r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'library/std/src/io/util.rs')
| -rw-r--r-- | library/std/src/io/util.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/library/std/src/io/util.rs b/library/std/src/io/util.rs index b4c4dffc371..424f862090f 100644 --- a/library/std/src/io/util.rs +++ b/library/std/src/io/util.rs @@ -188,6 +188,13 @@ impl Read for Repeat { Ok(buf.len()) } + fn read_exact(&mut self, buf: &mut [u8]) -> io::Result<()> { + for slot in &mut *buf { + *slot = self.byte; + } + Ok(()) + } + fn read_buf(&mut self, mut buf: BorrowedCursor<'_>) -> io::Result<()> { // SAFETY: No uninit bytes are being written for slot in unsafe { buf.as_mut() } { @@ -204,6 +211,10 @@ impl Read for Repeat { Ok(()) } + fn read_buf_exact(&mut self, buf: BorrowedCursor<'_>) -> io::Result<()> { + self.read_buf(buf) + } + /// This function is not supported by `io::Repeat`, because there's no end of its data fn read_to_end(&mut self, _: &mut Vec<u8>) -> io::Result<usize> { Err(io::Error::from(io::ErrorKind::OutOfMemory)) |
