std.Io.Reader: remove aggressive assert from fill

with `.fixed("")` you should still be able to do `fill(1)` and have it
return error.EndOfStream.
This commit is contained in:
Andrew Kelley 2025-07-19 16:02:06 -07:00
parent a0d1682921
commit a288266f33

View file

@ -990,9 +990,9 @@ pub fn discardDelimiterLimit(r: *Reader, delimiter: u8, limit: Limit) DiscardDel
/// Returns `error.EndOfStream` if and only if there are fewer than `n` bytes /// Returns `error.EndOfStream` if and only if there are fewer than `n` bytes
/// remaining. /// remaining.
/// ///
/// Asserts buffer capacity is at least `n`. /// If the end of stream is not encountered, asserts buffer capacity is at
/// least `n`.
pub fn fill(r: *Reader, n: usize) Error!void { pub fn fill(r: *Reader, n: usize) Error!void {
assert(n <= r.buffer.len);
if (r.seek + n <= r.end) { if (r.seek + n <= r.end) {
@branchHint(.likely); @branchHint(.likely);
return; return;