about summary refs log tree commit diff
path: root/library/std/src/io/buffered/bufreader
AgeCommit message (Collapse)AuthorLines
2025-08-17bufreader::Buffer::backshift: don't move the uninit bytesbinarycat-1/+1
previous code was perfectly sound because of MaybeUninit, but it did waste cycles on copying memory that is known to be uninitialized.
2025-04-01io: Avoid Avoid marking bytes as uninit in `BufReader::peek`Benoît du Garreau-1/+0
2025-02-28Fix logic error in Buffer::read_more()Will Woods-2/+2
Buffer::read_more() is supposed to refill the buffer without discarding its contents, which are in the range `pos .. filled`. It mistakenly borrows the range `pos ..`, fills that, and then increments `filled` by the amount read. This overwrites the buffer's existing contents and sets `filled` to a too-large value that either exposes uninitialized bytes or walks off the end of the buffer entirely. This patch makes it correctly fill only the unfilled portion of the buffer, which should maintain all the type invariants and fix the test failure introduced in commit b1196717fcb.
2025-01-11Add inherent versions of MaybeUninit methods for slicesltdk-1/+1
2024-11-26std: update internal uses of `io::const_error!`joboet-1/+1
2024-09-28Rollup merge of #125404 - a1phyr:fix-read_buf-uses, r=workingjubileeMatthias Krüger-1/+3
Fix `read_buf` uses in `std` Following lib-team decision here: https://github.com/rust-lang/rust/issues/78485#issuecomment-2122992314 Guard against the pathological behavior of both returning an error and performing a read.
2024-09-24Pre-allocate buffers in `File::open_buffered` and `create_buffered`Josh Stone-1/+11
2024-09-23Fix `io::BufReader` uses of `read_buf`Benoît du Garreau-1/+3
2024-09-06properly handle EOF in BufReader::peekbinarycat-2/+2
previously this would cause an infinite loop due to it being unable to read `n` bytes.
2024-08-05implement BufReader::peekbinarycat-0/+21
2024-06-20Convert some module-level `//` and `///` comments to `//!`.Nicholas Nethercote-10/+11
This makes their intent and expected location clearer. We see some examples where these comments were not clearly separate from `use` declarations, which made it hard to understand what the comment is describing.
2022-10-06Avoid defensive re-initialization of the BufReader bufferBen Kimock-3/+16
2022-08-18Address reviewer commentsNick Cameron-1/+1
Signed-off-by: Nick Cameron <nrc@ncameron.org>
2022-08-05non-linux platformsNick Cameron-4/+8
Signed-off-by: Nick Cameron <nrc@ncameron.org>
2022-07-26Add Buffer::consume_with to enable direct buffer access with one checkBen Kimock-0/+17
2022-07-24Rename and document the new BufReader internalsBen Kimock-22/+26
2022-07-24Allow Buffer methods to inlineBen Kimock-0/+9
2022-07-24Remove some redundant checks from BufReaderBen Kimock-0/+75
The implementation of BufReader contains a lot of redundant checks. While any one of these checks is not particularly expensive to execute, especially when taken together they dramatically inhibit LLVM's ability to make subsequent optimizations.