| Age | Commit message (Collapse) | Author | Lines |
|
previous code was perfectly sound because of MaybeUninit,
but it did waste cycles on copying memory that is
known to be uninitialized.
|
|
|
|
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.
|
|
|
|
|
|
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.
|
|
|
|
|
|
previously this would cause an infinite loop due to it being
unable to read `n` bytes.
|
|
|
|
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.
|
|
|
|
Signed-off-by: Nick Cameron <nrc@ncameron.org>
|
|
Signed-off-by: Nick Cameron <nrc@ncameron.org>
|
|
|
|
|
|
|
|
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.
|