authorgravatar for thejoshwolfe@gmail.comJosh Wolfe <thejoshwolfe@gmail.com> 2025-08-15 17:04:39-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-08-16 00:23:47-07:00
log4fcdb08390dc1496b74a3e652498f9a0b27fada5
treee76f2abe797dee903bbff96c9e6d323d5c0f6156
parent99c489055951c09c1a22973078e5d7dbda14bac1

[std] fix compile error in std.Io.Writer.failing


1 files changed, 6 insertions(+), 0 deletions(-)

lib/std/Io/Writer.zig+6
...@@ -141,8 +141,14 @@ pub const failing: Writer = .{...@@ -141,8 +141,14 @@ pub const failing: Writer = .{
141 .sendFile = failingSendFile,141 .sendFile = failingSendFile,
142 .rebase = failingRebase,142 .rebase = failingRebase,
143 },143 },
144 .buffer = &.{},
144};145};
145146
147test failing {
148 var fw: Writer = .failing;
149 try testing.expectError(error.WriteFailed, fw.writeAll("always fails"));
150}
151
146/// Returns the contents not yet drained.152/// Returns the contents not yet drained.
147pub fn buffered(w: *const Writer) []u8 {153pub fn buffered(w: *const Writer) []u8 {
148 return w.buffer[0..w.end];154 return w.buffer[0..w.end];