std: fix StreamSource to disallow writing to a const buffer

This commit is contained in:
daurnimator 2020-04-14 01:24:18 +10:00 committed by Andrew Kelley
parent b702964ae2
commit d29ed2a785

View File

@ -39,7 +39,7 @@ pub const StreamSource = union(enum) {
pub fn write(self: *StreamSource, bytes: []const u8) WriteError!usize {
switch (self.*) {
.buffer => |*x| return x.write(bytes),
.const_buffer => |*x| return x.write(bytes),
.const_buffer => return error.AccessDenied,
.file => |x| return x.write(bytes),
}
}