| author | |
| committer | |
| log | a9b505fa7774e2e8451bedfa7bea27d7227572e7 |
| tree | 408a88da61e15d5ace79ecefebfe868c09f80d35 |
| parent | 8e9a1ac364360b160438af0b96132d5aacf39a71 |
Related: #491743 files changed, 159 insertions(+), 159 deletions(-)
doc/docgen.zig+4-4| ... | @@ -40,9 +40,9 @@ pub fn main() !void { | ... | @@ -40,9 +40,9 @@ pub fn main() !void { |
| 40 | var out_file = try fs.cwd().createFile(out_file_name, .{}); | 40 | var out_file = try fs.cwd().createFile(out_file_name, .{}); |
| 41 | defer out_file.close(); | 41 | defer out_file.close(); |
| 42 | 42 | ||
| 43 | const input_file_bytes = try in_file.inStream().readAllAlloc(allocator, max_doc_file_size); | 43 | const input_file_bytes = try in_file.reader().readAllAlloc(allocator, max_doc_file_size); |
| 44 | 44 | ||
| 45 | var buffered_out_stream = io.bufferedOutStream(out_file.writer()); | 45 | var buffered_writer = io.bufferedWriter(out_file.writer()); |
| 46 | 46 | ||
| 47 | var tokenizer = Tokenizer.init(in_file_name, input_file_bytes); | 47 | var tokenizer = Tokenizer.init(in_file_name, input_file_bytes); |
| 48 | var toc = try genToc(allocator, &tokenizer); | 48 | var toc = try genToc(allocator, &tokenizer); |
| ... | @@ -50,8 +50,8 @@ pub fn main() !void { | ... | @@ -50,8 +50,8 @@ pub fn main() !void { |
| 50 | try fs.cwd().makePath(tmp_dir_name); | 50 | try fs.cwd().makePath(tmp_dir_name); |
| 51 | defer fs.cwd().deleteTree(tmp_dir_name) catch {}; | 51 | defer fs.cwd().deleteTree(tmp_dir_name) catch {}; |
| 52 | 52 | ||
| 53 | try genHtml(allocator, &tokenizer, &toc, buffered_out_stream.writer(), zig_exe); | 53 | try genHtml(allocator, &tokenizer, &toc, buffered_writer.writer(), zig_exe); |
| 54 | try buffered_out_stream.flush(); | 54 | try buffered_writer.flush(); |
| 55 | } | 55 | } |
| 56 | 56 | ||
| 57 | const Token = struct { | 57 | const Token = struct { |
lib/std/Progress.zig+1-1| ... | @@ -271,7 +271,7 @@ fn refreshWithHeldLock(self: *Progress) void { | ... | @@ -271,7 +271,7 @@ fn refreshWithHeldLock(self: *Progress) void { |
| 271 | pub fn log(self: *Progress, comptime format: []const u8, args: anytype) void { | 271 | pub fn log(self: *Progress, comptime format: []const u8, args: anytype) void { |
| 272 | const file = self.terminal orelse return; | 272 | const file = self.terminal orelse return; |
| 273 | self.refresh(); | 273 | self.refresh(); |
| 274 | file.outStream().print(format, args) catch { | 274 | file.writer().print(format, args) catch { |
| 275 | self.terminal = null; | 275 | self.terminal = null; |
| 276 | return; | 276 | return; |
| 277 | }; | 277 | }; |
lib/std/atomic/queue.zig+4-4| ... | @@ -122,7 +122,7 @@ pub fn Queue(comptime T: type) type { | ... | @@ -122,7 +122,7 @@ pub fn Queue(comptime T: type) type { |
| 122 | 122 | ||
| 123 | /// Dumps the contents of the queue to `stderr`. | 123 | /// Dumps the contents of the queue to `stderr`. |
| 124 | pub fn dump(self: *Self) void { | 124 | pub fn dump(self: *Self) void { |
| 125 | self.dumpToStream(std.io.getStdErr().outStream()) catch return; | 125 | self.dumpToStream(std.io.getStdErr().writer()) catch return; |
| 126 | } | 126 | } |
| 127 | 127 | ||
| 128 | /// Dumps the contents of the queue to `stream`. | 128 | /// Dumps the contents of the queue to `stream`. |
| ... | @@ -351,7 +351,7 @@ test "std.atomic.Queue dump" { | ... | @@ -351,7 +351,7 @@ test "std.atomic.Queue dump" { |
| 351 | 351 | ||
| 352 | // Test empty stream | 352 | // Test empty stream |
| 353 | fbs.reset(); | 353 | fbs.reset(); |
| 354 | try queue.dumpToStream(fbs.outStream()); | 354 | try queue.dumpToStream(fbs.writer()); |
| 355 | expect(mem.eql(u8, buffer[0..fbs.pos], | 355 | expect(mem.eql(u8, buffer[0..fbs.pos], |
| 356 | \\head: (null) | 356 | \\head: (null) |
| 357 | \\tail: (null) | 357 | \\tail: (null) |
| ... | @@ -367,7 +367,7 @@ test "std.atomic.Queue dump" { | ... | @@ -367,7 +367,7 @@ test "std.atomic.Queue dump" { |
| 367 | queue.put(&node_0); | 367 | queue.put(&node_0); |
| 368 | 368 | ||
| 369 | fbs.reset(); | 369 | fbs.reset(); |
| 370 | try queue.dumpToStream(fbs.outStream()); | 370 | try queue.dumpToStream(fbs.writer()); |
| 371 | 371 | ||
| 372 | var expected = try std.fmt.bufPrint(expected_buffer[0..], | 372 | var expected = try std.fmt.bufPrint(expected_buffer[0..], |
| 373 | \\head: 0x{x}=1 | 373 | \\head: 0x{x}=1 |
| ... | @@ -387,7 +387,7 @@ test "std.atomic.Queue dump" { | ... | @@ -387,7 +387,7 @@ test "std.atomic.Queue dump" { |
| 387 | queue.put(&node_1); | 387 | queue.put(&node_1); |
| 388 | 388 | ||
| 389 | fbs.reset(); | 389 | fbs.reset(); |
| 390 | try queue.dumpToStream(fbs.outStream()); | 390 | try queue.dumpToStream(fbs.writer()); |
| 391 | 391 | ||
| 392 | expected = try std.fmt.bufPrint(expected_buffer[0..], | 392 | expected = try std.fmt.bufPrint(expected_buffer[0..], |
| 393 | \\head: 0x{x}=1 | 393 | \\head: 0x{x}=1 |
lib/std/build.zig+5-5| ... | @@ -1042,7 +1042,7 @@ pub const Builder = struct { | ... | @@ -1042,7 +1042,7 @@ pub const Builder = struct { |
| 1042 | 1042 | ||
| 1043 | try child.spawn(); | 1043 | try child.spawn(); |
| 1044 | 1044 | ||
| 1045 | const stdout = try child.stdout.?.inStream().readAllAlloc(self.allocator, max_output_size); | 1045 | const stdout = try child.stdout.?.reader().readAllAlloc(self.allocator, max_output_size); |
| 1046 | errdefer self.allocator.free(stdout); | 1046 | errdefer self.allocator.free(stdout); |
| 1047 | 1047 | ||
| 1048 | const term = try child.wait(); | 1048 | const term = try child.wait(); |
| ... | @@ -1849,7 +1849,7 @@ pub const LibExeObjStep = struct { | ... | @@ -1849,7 +1849,7 @@ pub const LibExeObjStep = struct { |
| 1849 | } | 1849 | } |
| 1850 | 1850 | ||
| 1851 | pub fn addBuildOption(self: *LibExeObjStep, comptime T: type, name: []const u8, value: T) void { | 1851 | pub fn addBuildOption(self: *LibExeObjStep, comptime T: type, name: []const u8, value: T) void { |
| 1852 | const out = self.build_options_contents.outStream(); | 1852 | const out = self.build_options_contents.writer(); |
| 1853 | switch (T) { | 1853 | switch (T) { |
| 1854 | []const []const u8 => { | 1854 | []const []const u8 => { |
| 1855 | out.print("pub const {z}: []const []const u8 = &[_][]const u8{{\n", .{name}) catch unreachable; | 1855 | out.print("pub const {z}: []const []const u8 = &[_][]const u8{{\n", .{name}) catch unreachable; |
| ... | @@ -2295,16 +2295,16 @@ pub const LibExeObjStep = struct { | ... | @@ -2295,16 +2295,16 @@ pub const LibExeObjStep = struct { |
| 2295 | } else { | 2295 | } else { |
| 2296 | var mcpu_buffer = std.ArrayList(u8).init(builder.allocator); | 2296 | var mcpu_buffer = std.ArrayList(u8).init(builder.allocator); |
| 2297 | 2297 | ||
| 2298 | try mcpu_buffer.outStream().print("-mcpu={s}", .{cross.cpu.model.name}); | 2298 | try mcpu_buffer.writer().print("-mcpu={s}", .{cross.cpu.model.name}); |
| 2299 | 2299 | ||
| 2300 | for (all_features) |feature, i_usize| { | 2300 | for (all_features) |feature, i_usize| { |
| 2301 | const i = @intCast(std.Target.Cpu.Feature.Set.Index, i_usize); | 2301 | const i = @intCast(std.Target.Cpu.Feature.Set.Index, i_usize); |
| 2302 | const in_cpu_set = populated_cpu_features.isEnabled(i); | 2302 | const in_cpu_set = populated_cpu_features.isEnabled(i); |
| 2303 | const in_actual_set = cross.cpu.features.isEnabled(i); | 2303 | const in_actual_set = cross.cpu.features.isEnabled(i); |
| 2304 | if (in_cpu_set and !in_actual_set) { | 2304 | if (in_cpu_set and !in_actual_set) { |
| 2305 | try mcpu_buffer.outStream().print("-{s}", .{feature.name}); | 2305 | try mcpu_buffer.writer().print("-{s}", .{feature.name}); |
| 2306 | } else if (!in_cpu_set and in_actual_set) { | 2306 | } else if (!in_cpu_set and in_actual_set) { |
| 2307 | try mcpu_buffer.outStream().print("+{s}", .{feature.name}); | 2307 | try mcpu_buffer.writer().print("+{s}", .{feature.name}); |
| 2308 | } | 2308 | } |
| 2309 | } | 2309 | } |
| 2310 | 2310 |
lib/std/build/run.zig+2-2| ... | @@ -200,7 +200,7 @@ pub const RunStep = struct { | ... | @@ -200,7 +200,7 @@ pub const RunStep = struct { |
| 200 | 200 | ||
| 201 | switch (self.stdout_action) { | 201 | switch (self.stdout_action) { |
| 202 | .expect_exact, .expect_matches => { | 202 | .expect_exact, .expect_matches => { |
| 203 | stdout = child.stdout.?.inStream().readAllAlloc(self.builder.allocator, max_stdout_size) catch unreachable; | 203 | stdout = child.stdout.?.reader().readAllAlloc(self.builder.allocator, max_stdout_size) catch unreachable; |
| 204 | }, | 204 | }, |
| 205 | .inherit, .ignore => {}, | 205 | .inherit, .ignore => {}, |
| 206 | } | 206 | } |
| ... | @@ -210,7 +210,7 @@ pub const RunStep = struct { | ... | @@ -210,7 +210,7 @@ pub const RunStep = struct { |
| 210 | 210 | ||
| 211 | switch (self.stderr_action) { | 211 | switch (self.stderr_action) { |
| 212 | .expect_exact, .expect_matches => { | 212 | .expect_exact, .expect_matches => { |
| 213 | stderr = child.stderr.?.inStream().readAllAlloc(self.builder.allocator, max_stdout_size) catch unreachable; | 213 | stderr = child.stderr.?.reader().readAllAlloc(self.builder.allocator, max_stdout_size) catch unreachable; |
| 214 | }, | 214 | }, |
| 215 | .inherit, .ignore => {}, | 215 | .inherit, .ignore => {}, |
| 216 | } | 216 | } |
lib/std/child_process.zig+1-1| ... | @@ -922,7 +922,7 @@ fn writeIntFd(fd: i32, value: ErrInt) !void { | ... | @@ -922,7 +922,7 @@ fn writeIntFd(fd: i32, value: ErrInt) !void { |
| 922 | .capable_io_mode = .blocking, | 922 | .capable_io_mode = .blocking, |
| 923 | .intended_io_mode = .blocking, | 923 | .intended_io_mode = .blocking, |
| 924 | }; | 924 | }; |
| 925 | file.outStream().writeIntNative(u64, @intCast(u64, value)) catch return error.SystemResources; | 925 | file.writer().writeIntNative(u64, @intCast(u64, value)) catch return error.SystemResources; |
| 926 | } | 926 | } |
| 927 | 927 | ||
| 928 | fn readIntFd(fd: i32) !ErrInt { | 928 | fn readIntFd(fd: i32) !ErrInt { |
lib/std/coff.zig+4-4| ... | @@ -127,7 +127,7 @@ pub const Coff = struct { | ... | @@ -127,7 +127,7 @@ pub const Coff = struct { |
| 127 | pub fn loadHeader(self: *Coff) !void { | 127 | pub fn loadHeader(self: *Coff) !void { |
| 128 | const pe_pointer_offset = 0x3C; | 128 | const pe_pointer_offset = 0x3C; |
| 129 | 129 | ||
| 130 | const in = self.in_file.inStream(); | 130 | const in = self.in_file.reader(); |
| 131 | 131 | ||
| 132 | var magic: [2]u8 = undefined; | 132 | var magic: [2]u8 = undefined; |
| 133 | try in.readNoEof(magic[0..]); | 133 | try in.readNoEof(magic[0..]); |
| ... | @@ -163,7 +163,7 @@ pub const Coff = struct { | ... | @@ -163,7 +163,7 @@ pub const Coff = struct { |
| 163 | } | 163 | } |
| 164 | 164 | ||
| 165 | fn loadOptionalHeader(self: *Coff) !void { | 165 | fn loadOptionalHeader(self: *Coff) !void { |
| 166 | const in = self.in_file.inStream(); | 166 | const in = self.in_file.reader(); |
| 167 | self.pe_header.magic = try in.readIntLittle(u16); | 167 | self.pe_header.magic = try in.readIntLittle(u16); |
| 168 | // For now we're only interested in finding the reference to the .pdb, | 168 | // For now we're only interested in finding the reference to the .pdb, |
| 169 | // so we'll skip most of this header, which size is different in 32 | 169 | // so we'll skip most of this header, which size is different in 32 |
| ... | @@ -206,7 +206,7 @@ pub const Coff = struct { | ... | @@ -206,7 +206,7 @@ pub const Coff = struct { |
| 206 | const debug_dir = &self.pe_header.data_directory[DEBUG_DIRECTORY]; | 206 | const debug_dir = &self.pe_header.data_directory[DEBUG_DIRECTORY]; |
| 207 | const file_offset = debug_dir.virtual_address - header.virtual_address + header.pointer_to_raw_data; | 207 | const file_offset = debug_dir.virtual_address - header.virtual_address + header.pointer_to_raw_data; |
| 208 | 208 | ||
| 209 | const in = self.in_file.inStream(); | 209 | const in = self.in_file.reader(); |
| 210 | try self.in_file.seekTo(file_offset); | 210 | try self.in_file.seekTo(file_offset); |
| 211 | 211 | ||
| 212 | // Find the correct DebugDirectoryEntry, and where its data is stored. | 212 | // Find the correct DebugDirectoryEntry, and where its data is stored. |
| ... | @@ -257,7 +257,7 @@ pub const Coff = struct { | ... | @@ -257,7 +257,7 @@ pub const Coff = struct { |
| 257 | 257 | ||
| 258 | try self.sections.ensureCapacity(self.coff_header.number_of_sections); | 258 | try self.sections.ensureCapacity(self.coff_header.number_of_sections); |
| 259 | 259 | ||
| 260 | const in = self.in_file.inStream(); | 260 | const in = self.in_file.reader(); |
| 261 | 261 | ||
| 262 | var name: [8]u8 = undefined; | 262 | var name: [8]u8 = undefined; |
| 263 | 263 |
lib/std/crypto/benchmark.zig+1-1| ... | @@ -314,7 +314,7 @@ fn mode(comptime x: comptime_int) comptime_int { | ... | @@ -314,7 +314,7 @@ fn mode(comptime x: comptime_int) comptime_int { |
| 314 | } | 314 | } |
| 315 | 315 | ||
| 316 | pub fn main() !void { | 316 | pub fn main() !void { |
| 317 | const stdout = std.io.getStdOut().outStream(); | 317 | const stdout = std.io.getStdOut().writer(); |
| 318 | 318 | ||
| 319 | var buffer: [1024]u8 = undefined; | 319 | var buffer: [1024]u8 = undefined; |
| 320 | var fixed = std.heap.FixedBufferAllocator.init(buffer[0..]); | 320 | var fixed = std.heap.FixedBufferAllocator.init(buffer[0..]); |
lib/std/debug.zig+18-18| ... | @@ -517,15 +517,15 @@ fn populateModule(di: *ModuleDebugInfo, mod: *Module) !void { | ... | @@ -517,15 +517,15 @@ fn populateModule(di: *ModuleDebugInfo, mod: *Module) !void { |
| 517 | 517 | ||
| 518 | const modi = di.pdb.getStreamById(mod.mod_info.ModuleSymStream) orelse return error.MissingDebugInfo; | 518 | const modi = di.pdb.getStreamById(mod.mod_info.ModuleSymStream) orelse return error.MissingDebugInfo; |
| 519 | 519 | ||
| 520 | const signature = try modi.inStream().readIntLittle(u32); | 520 | const signature = try modi.reader().readIntLittle(u32); |
| 521 | if (signature != 4) | 521 | if (signature != 4) |
| 522 | return error.InvalidDebugInfo; | 522 | return error.InvalidDebugInfo; |
| 523 | 523 | ||
| 524 | mod.symbols = try allocator.alloc(u8, mod.mod_info.SymByteSize - 4); | 524 | mod.symbols = try allocator.alloc(u8, mod.mod_info.SymByteSize - 4); |
| 525 | try modi.inStream().readNoEof(mod.symbols); | 525 | try modi.reader().readNoEof(mod.symbols); |
| 526 | 526 | ||
| 527 | mod.subsect_info = try allocator.alloc(u8, mod.mod_info.C13ByteSize); | 527 | mod.subsect_info = try allocator.alloc(u8, mod.mod_info.C13ByteSize); |
| 528 | try modi.inStream().readNoEof(mod.subsect_info); | 528 | try modi.reader().readNoEof(mod.subsect_info); |
| 529 | 529 | ||
| 530 | var sect_offset: usize = 0; | 530 | var sect_offset: usize = 0; |
| 531 | var skip_len: usize = undefined; | 531 | var skip_len: usize = undefined; |
| ... | @@ -704,11 +704,11 @@ fn readCoffDebugInfo(allocator: *mem.Allocator, coff_file: File) !ModuleDebugInf | ... | @@ -704,11 +704,11 @@ fn readCoffDebugInfo(allocator: *mem.Allocator, coff_file: File) !ModuleDebugInf |
| 704 | try di.pdb.openFile(di.coff, path); | 704 | try di.pdb.openFile(di.coff, path); |
| 705 | 705 | ||
| 706 | var pdb_stream = di.pdb.getStream(pdb.StreamType.Pdb) orelse return error.InvalidDebugInfo; | 706 | var pdb_stream = di.pdb.getStream(pdb.StreamType.Pdb) orelse return error.InvalidDebugInfo; |
| 707 | const version = try pdb_stream.inStream().readIntLittle(u32); | 707 | const version = try pdb_stream.reader().readIntLittle(u32); |
| 708 | const signature = try pdb_stream.inStream().readIntLittle(u32); | 708 | const signature = try pdb_stream.reader().readIntLittle(u32); |
| 709 | const age = try pdb_stream.inStream().readIntLittle(u32); | 709 | const age = try pdb_stream.reader().readIntLittle(u32); |
| 710 | var guid: [16]u8 = undefined; | 710 | var guid: [16]u8 = undefined; |
| 711 | try pdb_stream.inStream().readNoEof(&guid); | 711 | try pdb_stream.reader().readNoEof(&guid); |
| 712 | if (version != 20000404) // VC70, only value observed by LLVM team | 712 | if (version != 20000404) // VC70, only value observed by LLVM team |
| 713 | return error.UnknownPDBVersion; | 713 | return error.UnknownPDBVersion; |
| 714 | if (!mem.eql(u8, &di.coff.guid, &guid) or di.coff.age != age) | 714 | if (!mem.eql(u8, &di.coff.guid, &guid) or di.coff.age != age) |
| ... | @@ -716,9 +716,9 @@ fn readCoffDebugInfo(allocator: *mem.Allocator, coff_file: File) !ModuleDebugInf | ... | @@ -716,9 +716,9 @@ fn readCoffDebugInfo(allocator: *mem.Allocator, coff_file: File) !ModuleDebugInf |
| 716 | // We validated the executable and pdb match. | 716 | // We validated the executable and pdb match. |
| 717 | 717 | ||
| 718 | const string_table_index = str_tab_index: { | 718 | const string_table_index = str_tab_index: { |
| 719 | const name_bytes_len = try pdb_stream.inStream().readIntLittle(u32); | 719 | const name_bytes_len = try pdb_stream.reader().readIntLittle(u32); |
| 720 | const name_bytes = try allocator.alloc(u8, name_bytes_len); | 720 | const name_bytes = try allocator.alloc(u8, name_bytes_len); |
| 721 | try pdb_stream.inStream().readNoEof(name_bytes); | 721 | try pdb_stream.reader().readNoEof(name_bytes); |
| 722 | 722 | ||
| 723 | const HashTableHeader = packed struct { | 723 | const HashTableHeader = packed struct { |
| 724 | Size: u32, | 724 | Size: u32, |
| ... | @@ -728,17 +728,17 @@ fn readCoffDebugInfo(allocator: *mem.Allocator, coff_file: File) !ModuleDebugInf | ... | @@ -728,17 +728,17 @@ fn readCoffDebugInfo(allocator: *mem.Allocator, coff_file: File) !ModuleDebugInf |
| 728 | return cap * 2 / 3 + 1; | 728 | return cap * 2 / 3 + 1; |
| 729 | } | 729 | } |
| 730 | }; | 730 | }; |
| 731 | const hash_tbl_hdr = try pdb_stream.inStream().readStruct(HashTableHeader); | 731 | const hash_tbl_hdr = try pdb_stream.reader().readStruct(HashTableHeader); |
| 732 | if (hash_tbl_hdr.Capacity == 0) | 732 | if (hash_tbl_hdr.Capacity == 0) |
| 733 | return error.InvalidDebugInfo; | 733 | return error.InvalidDebugInfo; |
| 734 | 734 | ||
| 735 | if (hash_tbl_hdr.Size > HashTableHeader.maxLoad(hash_tbl_hdr.Capacity)) | 735 | if (hash_tbl_hdr.Size > HashTableHeader.maxLoad(hash_tbl_hdr.Capacity)) |
| 736 | return error.InvalidDebugInfo; | 736 | return error.InvalidDebugInfo; |
| 737 | 737 | ||
| 738 | const present = try readSparseBitVector(&pdb_stream.inStream(), allocator); | 738 | const present = try readSparseBitVector(&pdb_stream.reader(), allocator); |
| 739 | if (present.len != hash_tbl_hdr.Size) | 739 | if (present.len != hash_tbl_hdr.Size) |
| 740 | return error.InvalidDebugInfo; | 740 | return error.InvalidDebugInfo; |
| 741 | const deleted = try readSparseBitVector(&pdb_stream.inStream(), allocator); | 741 | const deleted = try readSparseBitVector(&pdb_stream.reader(), allocator); |
| 742 | 742 | ||
| 743 | const Bucket = struct { | 743 | const Bucket = struct { |
| 744 | first: u32, | 744 | first: u32, |
| ... | @@ -746,8 +746,8 @@ fn readCoffDebugInfo(allocator: *mem.Allocator, coff_file: File) !ModuleDebugInf | ... | @@ -746,8 +746,8 @@ fn readCoffDebugInfo(allocator: *mem.Allocator, coff_file: File) !ModuleDebugInf |
| 746 | }; | 746 | }; |
| 747 | const bucket_list = try allocator.alloc(Bucket, present.len); | 747 | const bucket_list = try allocator.alloc(Bucket, present.len); |
| 748 | for (present) |_| { | 748 | for (present) |_| { |
| 749 | const name_offset = try pdb_stream.inStream().readIntLittle(u32); | 749 | const name_offset = try pdb_stream.reader().readIntLittle(u32); |
| 750 | const name_index = try pdb_stream.inStream().readIntLittle(u32); | 750 | const name_index = try pdb_stream.reader().readIntLittle(u32); |
| 751 | const name = mem.spanZ(std.meta.assumeSentinel(name_bytes.ptr + name_offset, 0)); | 751 | const name = mem.spanZ(std.meta.assumeSentinel(name_bytes.ptr + name_offset, 0)); |
| 752 | if (mem.eql(u8, name, "/names")) { | 752 | if (mem.eql(u8, name, "/names")) { |
| 753 | break :str_tab_index name_index; | 753 | break :str_tab_index name_index; |
| ... | @@ -762,7 +762,7 @@ fn readCoffDebugInfo(allocator: *mem.Allocator, coff_file: File) !ModuleDebugInf | ... | @@ -762,7 +762,7 @@ fn readCoffDebugInfo(allocator: *mem.Allocator, coff_file: File) !ModuleDebugInf |
| 762 | const dbi = di.pdb.dbi; | 762 | const dbi = di.pdb.dbi; |
| 763 | 763 | ||
| 764 | // Dbi Header | 764 | // Dbi Header |
| 765 | const dbi_stream_header = try dbi.inStream().readStruct(pdb.DbiStreamHeader); | 765 | const dbi_stream_header = try dbi.reader().readStruct(pdb.DbiStreamHeader); |
| 766 | if (dbi_stream_header.VersionHeader != 19990903) // V70, only value observed by LLVM team | 766 | if (dbi_stream_header.VersionHeader != 19990903) // V70, only value observed by LLVM team |
| 767 | return error.UnknownPDBVersion; | 767 | return error.UnknownPDBVersion; |
| 768 | if (dbi_stream_header.Age != age) | 768 | if (dbi_stream_header.Age != age) |
| ... | @@ -776,7 +776,7 @@ fn readCoffDebugInfo(allocator: *mem.Allocator, coff_file: File) !ModuleDebugInf | ... | @@ -776,7 +776,7 @@ fn readCoffDebugInfo(allocator: *mem.Allocator, coff_file: File) !ModuleDebugInf |
| 776 | // Module Info Substream | 776 | // Module Info Substream |
| 777 | var mod_info_offset: usize = 0; | 777 | var mod_info_offset: usize = 0; |
| 778 | while (mod_info_offset != mod_info_size) { | 778 | while (mod_info_offset != mod_info_size) { |
| 779 | const mod_info = try dbi.inStream().readStruct(pdb.ModInfo); | 779 | const mod_info = try dbi.reader().readStruct(pdb.ModInfo); |
| 780 | var this_record_len: usize = @sizeOf(pdb.ModInfo); | 780 | var this_record_len: usize = @sizeOf(pdb.ModInfo); |
| 781 | 781 | ||
| 782 | const module_name = try dbi.readNullTermString(allocator); | 782 | const module_name = try dbi.readNullTermString(allocator); |
| ... | @@ -814,14 +814,14 @@ fn readCoffDebugInfo(allocator: *mem.Allocator, coff_file: File) !ModuleDebugInf | ... | @@ -814,14 +814,14 @@ fn readCoffDebugInfo(allocator: *mem.Allocator, coff_file: File) !ModuleDebugInf |
| 814 | var sect_contribs = ArrayList(pdb.SectionContribEntry).init(allocator); | 814 | var sect_contribs = ArrayList(pdb.SectionContribEntry).init(allocator); |
| 815 | var sect_cont_offset: usize = 0; | 815 | var sect_cont_offset: usize = 0; |
| 816 | if (section_contrib_size != 0) { | 816 | if (section_contrib_size != 0) { |
| 817 | const ver = @intToEnum(pdb.SectionContrSubstreamVersion, try dbi.inStream().readIntLittle(u32)); | 817 | const ver = @intToEnum(pdb.SectionContrSubstreamVersion, try dbi.reader().readIntLittle(u32)); |
| 818 | if (ver != pdb.SectionContrSubstreamVersion.Ver60) | 818 | if (ver != pdb.SectionContrSubstreamVersion.Ver60) |
| 819 | return error.InvalidDebugInfo; | 819 | return error.InvalidDebugInfo; |
| 820 | sect_cont_offset += @sizeOf(u32); | 820 | sect_cont_offset += @sizeOf(u32); |
| 821 | } | 821 | } |
| 822 | while (sect_cont_offset != section_contrib_size) { | 822 | while (sect_cont_offset != section_contrib_size) { |
| 823 | const entry = try sect_contribs.addOne(); | 823 | const entry = try sect_contribs.addOne(); |
| 824 | entry.* = try dbi.inStream().readStruct(pdb.SectionContribEntry); | 824 | entry.* = try dbi.reader().readStruct(pdb.SectionContribEntry); |
| 825 | sect_cont_offset += @sizeOf(pdb.SectionContribEntry); | 825 | sect_cont_offset += @sizeOf(pdb.SectionContribEntry); |
| 826 | 826 | ||
| 827 | if (sect_cont_offset > section_contrib_size) | 827 | if (sect_cont_offset > section_contrib_size) |
lib/std/dwarf.zig+5-5| ... | @@ -408,7 +408,7 @@ pub const DwarfInfo = struct { | ... | @@ -408,7 +408,7 @@ pub const DwarfInfo = struct { |
| 408 | 408 | ||
| 409 | fn scanAllFunctions(di: *DwarfInfo) !void { | 409 | fn scanAllFunctions(di: *DwarfInfo) !void { |
| 410 | var stream = io.fixedBufferStream(di.debug_info); | 410 | var stream = io.fixedBufferStream(di.debug_info); |
| 411 | const in = &stream.inStream(); | 411 | const in = &stream.reader(); |
| 412 | const seekable = &stream.seekableStream(); | 412 | const seekable = &stream.seekableStream(); |
| 413 | var this_unit_offset: u64 = 0; | 413 | var this_unit_offset: u64 = 0; |
| 414 | 414 | ||
| ... | @@ -512,7 +512,7 @@ pub const DwarfInfo = struct { | ... | @@ -512,7 +512,7 @@ pub const DwarfInfo = struct { |
| 512 | 512 | ||
| 513 | fn scanAllCompileUnits(di: *DwarfInfo) !void { | 513 | fn scanAllCompileUnits(di: *DwarfInfo) !void { |
| 514 | var stream = io.fixedBufferStream(di.debug_info); | 514 | var stream = io.fixedBufferStream(di.debug_info); |
| 515 | const in = &stream.inStream(); | 515 | const in = &stream.reader(); |
| 516 | const seekable = &stream.seekableStream(); | 516 | const seekable = &stream.seekableStream(); |
| 517 | var this_unit_offset: u64 = 0; | 517 | var this_unit_offset: u64 = 0; |
| 518 | 518 | ||
| ... | @@ -585,7 +585,7 @@ pub const DwarfInfo = struct { | ... | @@ -585,7 +585,7 @@ pub const DwarfInfo = struct { |
| 585 | if (di.debug_ranges) |debug_ranges| { | 585 | if (di.debug_ranges) |debug_ranges| { |
| 586 | if (compile_unit.die.getAttrSecOffset(AT_ranges)) |ranges_offset| { | 586 | if (compile_unit.die.getAttrSecOffset(AT_ranges)) |ranges_offset| { |
| 587 | var stream = io.fixedBufferStream(debug_ranges); | 587 | var stream = io.fixedBufferStream(debug_ranges); |
| 588 | const in = &stream.inStream(); | 588 | const in = &stream.reader(); |
| 589 | const seekable = &stream.seekableStream(); | 589 | const seekable = &stream.seekableStream(); |
| 590 | 590 | ||
| 591 | // All the addresses in the list are relative to the value | 591 | // All the addresses in the list are relative to the value |
| ... | @@ -640,7 +640,7 @@ pub const DwarfInfo = struct { | ... | @@ -640,7 +640,7 @@ pub const DwarfInfo = struct { |
| 640 | 640 | ||
| 641 | fn parseAbbrevTable(di: *DwarfInfo, offset: u64) !AbbrevTable { | 641 | fn parseAbbrevTable(di: *DwarfInfo, offset: u64) !AbbrevTable { |
| 642 | var stream = io.fixedBufferStream(di.debug_abbrev); | 642 | var stream = io.fixedBufferStream(di.debug_abbrev); |
| 643 | const in = &stream.inStream(); | 643 | const in = &stream.reader(); |
| 644 | const seekable = &stream.seekableStream(); | 644 | const seekable = &stream.seekableStream(); |
| 645 | 645 | ||
| 646 | try seekable.seekTo(offset); | 646 | try seekable.seekTo(offset); |
| ... | @@ -691,7 +691,7 @@ pub const DwarfInfo = struct { | ... | @@ -691,7 +691,7 @@ pub const DwarfInfo = struct { |
| 691 | 691 | ||
| 692 | pub fn getLineNumberInfo(di: *DwarfInfo, compile_unit: CompileUnit, target_address: usize) !debug.LineInfo { | 692 | pub fn getLineNumberInfo(di: *DwarfInfo, compile_unit: CompileUnit, target_address: usize) !debug.LineInfo { |
| 693 | var stream = io.fixedBufferStream(di.debug_line); | 693 | var stream = io.fixedBufferStream(di.debug_line); |
| 694 | const in = &stream.inStream(); | 694 | const in = &stream.reader(); |
| 695 | const seekable = &stream.seekableStream(); | 695 | const seekable = &stream.seekableStream(); |
| 696 | 696 | ||
| 697 | const compile_unit_cwd = try compile_unit.die.getAttrString(di, AT_comp_dir); | 697 | const compile_unit_cwd = try compile_unit.die.getAttrString(di, AT_comp_dir); |
lib/std/heap/logging_allocator.zig+1-1| ... | @@ -89,7 +89,7 @@ test "LoggingAllocator" { | ... | @@ -89,7 +89,7 @@ test "LoggingAllocator" { |
| 89 | 89 | ||
| 90 | var allocator_buf: [10]u8 = undefined; | 90 | var allocator_buf: [10]u8 = undefined; |
| 91 | var fixedBufferAllocator = std.mem.validationWrap(std.heap.FixedBufferAllocator.init(&allocator_buf)); | 91 | var fixedBufferAllocator = std.mem.validationWrap(std.heap.FixedBufferAllocator.init(&allocator_buf)); |
| 92 | const allocator = &loggingAllocator(&fixedBufferAllocator.allocator, fbs.outStream()).allocator; | 92 | const allocator = &loggingAllocator(&fixedBufferAllocator.allocator, fbs.writer()).allocator; |
| 93 | 93 | ||
| 94 | var a = try allocator.alloc(u8, 10); | 94 | var a = try allocator.alloc(u8, 10); |
| 95 | a = allocator.shrink(a, 5); | 95 | a = allocator.shrink(a, 5); |
lib/std/io/buffered_atomic_file.zig+1-1| ... | @@ -38,7 +38,7 @@ pub const BufferedAtomicFile = struct { | ... | @@ -38,7 +38,7 @@ pub const BufferedAtomicFile = struct { |
| 38 | self.atomic_file = try dir.atomicFile(dest_path, atomic_file_options); | 38 | self.atomic_file = try dir.atomicFile(dest_path, atomic_file_options); |
| 39 | errdefer self.atomic_file.deinit(); | 39 | errdefer self.atomic_file.deinit(); |
| 40 | 40 | ||
| 41 | self.file_stream = self.atomic_file.file.outStream(); | 41 | self.file_stream = self.atomic_file.file.writer(); |
| 42 | self.buffered_stream = .{ .unbuffered_writer = self.file_stream }; | 42 | self.buffered_stream = .{ .unbuffered_writer = self.file_stream }; |
| 43 | return self; | 43 | return self; |
| 44 | } | 44 | } |
lib/std/io/fixed_buffer_stream.zig+1-1| ... | @@ -45,7 +45,7 @@ pub fn FixedBufferStream(comptime Buffer: type) type { | ... | @@ -45,7 +45,7 @@ pub fn FixedBufferStream(comptime Buffer: type) type { |
| 45 | return .{ .context = self }; | 45 | return .{ .context = self }; |
| 46 | } | 46 | } |
| 47 | 47 | ||
| 48 | /// Deprecated: use `inStream` | 48 | /// Deprecated: use `reader` |
| 49 | pub fn inStream(self: *Self) InStream { | 49 | pub fn inStream(self: *Self) InStream { |
| 50 | return .{ .context = self }; | 50 | return .{ .context = self }; |
| 51 | } | 51 | } |
lib/std/io/test.zig+3-3| ... | @@ -30,8 +30,8 @@ test "write a file, read it, then delete it" { | ... | @@ -30,8 +30,8 @@ test "write a file, read it, then delete it" { |
| 30 | var file = try tmp.dir.createFile(tmp_file_name, .{}); | 30 | var file = try tmp.dir.createFile(tmp_file_name, .{}); |
| 31 | defer file.close(); | 31 | defer file.close(); |
| 32 | 32 | ||
| 33 | var buf_stream = io.bufferedOutStream(file.outStream()); | 33 | var buf_stream = io.bufferedWriter(file.writer()); |
| 34 | const st = buf_stream.outStream(); | 34 | const st = buf_stream.writer(); |
| 35 | try st.print("begin", .{}); | 35 | try st.print("begin", .{}); |
| 36 | try st.writeAll(data[0..]); | 36 | try st.writeAll(data[0..]); |
| 37 | try st.print("end", .{}); | 37 | try st.print("end", .{}); |
| ... | @@ -72,7 +72,7 @@ test "BitStreams with File Stream" { | ... | @@ -72,7 +72,7 @@ test "BitStreams with File Stream" { |
| 72 | var file = try tmp.dir.createFile(tmp_file_name, .{}); | 72 | var file = try tmp.dir.createFile(tmp_file_name, .{}); |
| 73 | defer file.close(); | 73 | defer file.close(); |
| 74 | 74 | ||
| 75 | var bit_stream = io.bitOutStream(builtin.endian, file.outStream()); | 75 | var bit_stream = io.bitWriter(builtin.endian, file.writer()); |
| 76 | 76 | ||
| 77 | try bit_stream.writeBits(@as(u2, 1), 1); | 77 | try bit_stream.writeBits(@as(u2, 1), 1); |
| 78 | try bit_stream.writeBits(@as(u5, 2), 2); | 78 | try bit_stream.writeBits(@as(u5, 2), 2); |
lib/std/json.zig+8-8| ... | @@ -1323,31 +1323,31 @@ test "Value.jsonStringify" { | ... | @@ -1323,31 +1323,31 @@ test "Value.jsonStringify" { |
| 1323 | { | 1323 | { |
| 1324 | var buffer: [10]u8 = undefined; | 1324 | var buffer: [10]u8 = undefined; |
| 1325 | var fbs = std.io.fixedBufferStream(&buffer); | 1325 | var fbs = std.io.fixedBufferStream(&buffer); |
| 1326 | try @as(Value, .Null).jsonStringify(.{}, fbs.outStream()); | 1326 | try @as(Value, .Null).jsonStringify(.{}, fbs.writer()); |
| 1327 | testing.expectEqualSlices(u8, fbs.getWritten(), "null"); | 1327 | testing.expectEqualSlices(u8, fbs.getWritten(), "null"); |
| 1328 | } | 1328 | } |
| 1329 | { | 1329 | { |
| 1330 | var buffer: [10]u8 = undefined; | 1330 | var buffer: [10]u8 = undefined; |
| 1331 | var fbs = std.io.fixedBufferStream(&buffer); | 1331 | var fbs = std.io.fixedBufferStream(&buffer); |
| 1332 | try (Value{ .Bool = true }).jsonStringify(.{}, fbs.outStream()); | 1332 | try (Value{ .Bool = true }).jsonStringify(.{}, fbs.writer()); |
| 1333 | testing.expectEqualSlices(u8, fbs.getWritten(), "true"); | 1333 | testing.expectEqualSlices(u8, fbs.getWritten(), "true"); |
| 1334 | } | 1334 | } |
| 1335 | { | 1335 | { |
| 1336 | var buffer: [10]u8 = undefined; | 1336 | var buffer: [10]u8 = undefined; |
| 1337 | var fbs = std.io.fixedBufferStream(&buffer); | 1337 | var fbs = std.io.fixedBufferStream(&buffer); |
| 1338 | try (Value{ .Integer = 42 }).jsonStringify(.{}, fbs.outStream()); | 1338 | try (Value{ .Integer = 42 }).jsonStringify(.{}, fbs.writer()); |
| 1339 | testing.expectEqualSlices(u8, fbs.getWritten(), "42"); | 1339 | testing.expectEqualSlices(u8, fbs.getWritten(), "42"); |
| 1340 | } | 1340 | } |
| 1341 | { | 1341 | { |
| 1342 | var buffer: [10]u8 = undefined; | 1342 | var buffer: [10]u8 = undefined; |
| 1343 | var fbs = std.io.fixedBufferStream(&buffer); | 1343 | var fbs = std.io.fixedBufferStream(&buffer); |
| 1344 | try (Value{ .Float = 42 }).jsonStringify(.{}, fbs.outStream()); | 1344 | try (Value{ .Float = 42 }).jsonStringify(.{}, fbs.writer()); |
| 1345 | testing.expectEqualSlices(u8, fbs.getWritten(), "4.2e+01"); | 1345 | testing.expectEqualSlices(u8, fbs.getWritten(), "4.2e+01"); |
| 1346 | } | 1346 | } |
| 1347 | { | 1347 | { |
| 1348 | var buffer: [10]u8 = undefined; | 1348 | var buffer: [10]u8 = undefined; |
| 1349 | var fbs = std.io.fixedBufferStream(&buffer); | 1349 | var fbs = std.io.fixedBufferStream(&buffer); |
| 1350 | try (Value{ .String = "weeee" }).jsonStringify(.{}, fbs.outStream()); | 1350 | try (Value{ .String = "weeee" }).jsonStringify(.{}, fbs.writer()); |
| 1351 | testing.expectEqualSlices(u8, fbs.getWritten(), "\"weeee\""); | 1351 | testing.expectEqualSlices(u8, fbs.getWritten(), "\"weeee\""); |
| 1352 | } | 1352 | } |
| 1353 | { | 1353 | { |
| ... | @@ -1360,7 +1360,7 @@ test "Value.jsonStringify" { | ... | @@ -1360,7 +1360,7 @@ test "Value.jsonStringify" { |
| 1360 | }; | 1360 | }; |
| 1361 | try (Value{ | 1361 | try (Value{ |
| 1362 | .Array = Array.fromOwnedSlice(undefined, &vals), | 1362 | .Array = Array.fromOwnedSlice(undefined, &vals), |
| 1363 | }).jsonStringify(.{}, fbs.outStream()); | 1363 | }).jsonStringify(.{}, fbs.writer()); |
| 1364 | testing.expectEqualSlices(u8, fbs.getWritten(), "[1,2,3]"); | 1364 | testing.expectEqualSlices(u8, fbs.getWritten(), "[1,2,3]"); |
| 1365 | } | 1365 | } |
| 1366 | { | 1366 | { |
| ... | @@ -1369,7 +1369,7 @@ test "Value.jsonStringify" { | ... | @@ -1369,7 +1369,7 @@ test "Value.jsonStringify" { |
| 1369 | var obj = ObjectMap.init(testing.allocator); | 1369 | var obj = ObjectMap.init(testing.allocator); |
| 1370 | defer obj.deinit(); | 1370 | defer obj.deinit(); |
| 1371 | try obj.putNoClobber("a", .{ .String = "b" }); | 1371 | try obj.putNoClobber("a", .{ .String = "b" }); |
| 1372 | try (Value{ .Object = obj }).jsonStringify(.{}, fbs.outStream()); | 1372 | try (Value{ .Object = obj }).jsonStringify(.{}, fbs.writer()); |
| 1373 | testing.expectEqualSlices(u8, fbs.getWritten(), "{\"a\":\"b\"}"); | 1373 | testing.expectEqualSlices(u8, fbs.getWritten(), "{\"a\":\"b\"}"); |
| 1374 | } | 1374 | } |
| 1375 | } | 1375 | } |
| ... | @@ -2223,7 +2223,7 @@ test "write json then parse it" { | ... | @@ -2223,7 +2223,7 @@ test "write json then parse it" { |
| 2223 | var out_buffer: [1000]u8 = undefined; | 2223 | var out_buffer: [1000]u8 = undefined; |
| 2224 | 2224 | ||
| 2225 | var fixed_buffer_stream = std.io.fixedBufferStream(&out_buffer); | 2225 | var fixed_buffer_stream = std.io.fixedBufferStream(&out_buffer); |
| 2226 | const out_stream = fixed_buffer_stream.outStream(); | 2226 | const out_stream = fixed_buffer_stream.writer(); |
| 2227 | var jw = writeStream(out_stream, 4); | 2227 | var jw = writeStream(out_stream, 4); |
| 2228 | 2228 | ||
| 2229 | try jw.beginObject(); | 2229 | try jw.beginObject(); |
lib/std/json/write_stream.zig+1-1| ... | @@ -238,7 +238,7 @@ pub fn writeStream( | ... | @@ -238,7 +238,7 @@ pub fn writeStream( |
| 238 | test "json write stream" { | 238 | test "json write stream" { |
| 239 | var out_buf: [1024]u8 = undefined; | 239 | var out_buf: [1024]u8 = undefined; |
| 240 | var slice_stream = std.io.fixedBufferStream(&out_buf); | 240 | var slice_stream = std.io.fixedBufferStream(&out_buf); |
| 241 | const out = slice_stream.outStream(); | 241 | const out = slice_stream.writer(); |
| 242 | 242 | ||
| 243 | var arena_allocator = std.heap.ArenaAllocator.init(std.testing.allocator); | 243 | var arena_allocator = std.heap.ArenaAllocator.init(std.testing.allocator); |
| 244 | defer arena_allocator.deinit(); | 244 | defer arena_allocator.deinit(); |
lib/std/net.zig+2-2| ... | @@ -1106,7 +1106,7 @@ fn linuxLookupNameFromHosts( | ... | @@ -1106,7 +1106,7 @@ fn linuxLookupNameFromHosts( |
| 1106 | }; | 1106 | }; |
| 1107 | defer file.close(); | 1107 | defer file.close(); |
| 1108 | 1108 | ||
| 1109 | const stream = std.io.bufferedInStream(file.inStream()).inStream(); | 1109 | const stream = std.io.bufferedReader(file.reader()).reader(); |
| 1110 | var line_buf: [512]u8 = undefined; | 1110 | var line_buf: [512]u8 = undefined; |
| 1111 | while (stream.readUntilDelimiterOrEof(&line_buf, '\n') catch |err| switch (err) { | 1111 | while (stream.readUntilDelimiterOrEof(&line_buf, '\n') catch |err| switch (err) { |
| 1112 | error.StreamTooLong => blk: { | 1112 | error.StreamTooLong => blk: { |
| ... | @@ -1304,7 +1304,7 @@ fn getResolvConf(allocator: *mem.Allocator, rc: *ResolvConf) !void { | ... | @@ -1304,7 +1304,7 @@ fn getResolvConf(allocator: *mem.Allocator, rc: *ResolvConf) !void { |
| 1304 | }; | 1304 | }; |
| 1305 | defer file.close(); | 1305 | defer file.close(); |
| 1306 | 1306 | ||
| 1307 | const stream = std.io.bufferedInStream(file.inStream()).inStream(); | 1307 | const stream = std.io.bufferedReader(file.reader()).reader(); |
| 1308 | var line_buf: [512]u8 = undefined; | 1308 | var line_buf: [512]u8 = undefined; |
| 1309 | while (stream.readUntilDelimiterOrEof(&line_buf, '\n') catch |err| switch (err) { | 1309 | while (stream.readUntilDelimiterOrEof(&line_buf, '\n') catch |err| switch (err) { |
| 1310 | error.StreamTooLong => blk: { | 1310 | error.StreamTooLong => blk: { |
lib/std/net/test.zig+1-1| ... | @@ -249,6 +249,6 @@ fn testServer(server: *net.StreamServer) anyerror!void { | ... | @@ -249,6 +249,6 @@ fn testServer(server: *net.StreamServer) anyerror!void { |
| 249 | 249 | ||
| 250 | var client = try server.accept(); | 250 | var client = try server.accept(); |
| 251 | 251 | ||
| 252 | const stream = client.file.outStream(); | 252 | const stream = client.file.writer(); |
| 253 | try stream.print("hello from server\n", .{}); | 253 | try stream.print("hello from server\n", .{}); |
| 254 | } | 254 | } |
lib/std/os.zig+1-1| ... | @@ -191,7 +191,7 @@ fn getRandomBytesDevURandom(buf: []u8) !void { | ... | @@ -191,7 +191,7 @@ fn getRandomBytesDevURandom(buf: []u8) !void { |
| 191 | .capable_io_mode = .blocking, | 191 | .capable_io_mode = .blocking, |
| 192 | .intended_io_mode = .blocking, | 192 | .intended_io_mode = .blocking, |
| 193 | }; | 193 | }; |
| 194 | const stream = file.inStream(); | 194 | const stream = file.reader(); |
| 195 | stream.readNoEof(buf) catch return error.Unexpected; | 195 | stream.readNoEof(buf) catch return error.Unexpected; |
| 196 | } | 196 | } |
| 197 | 197 |
lib/std/os/test.zig+3-3| ... | @@ -475,7 +475,7 @@ test "mmap" { | ... | @@ -475,7 +475,7 @@ test "mmap" { |
| 475 | const file = try tmp.dir.createFile(test_out_file, .{}); | 475 | const file = try tmp.dir.createFile(test_out_file, .{}); |
| 476 | defer file.close(); | 476 | defer file.close(); |
| 477 | 477 | ||
| 478 | const stream = file.outStream(); | 478 | const stream = file.writer(); |
| 479 | 479 | ||
| 480 | var i: u32 = 0; | 480 | var i: u32 = 0; |
| 481 | while (i < alloc_size / @sizeOf(u32)) : (i += 1) { | 481 | while (i < alloc_size / @sizeOf(u32)) : (i += 1) { |
| ... | @@ -499,7 +499,7 @@ test "mmap" { | ... | @@ -499,7 +499,7 @@ test "mmap" { |
| 499 | defer os.munmap(data); | 499 | defer os.munmap(data); |
| 500 | 500 | ||
| 501 | var mem_stream = io.fixedBufferStream(data); | 501 | var mem_stream = io.fixedBufferStream(data); |
| 502 | const stream = mem_stream.inStream(); | 502 | const stream = mem_stream.reader(); |
| 503 | 503 | ||
| 504 | var i: u32 = 0; | 504 | var i: u32 = 0; |
| 505 | while (i < alloc_size / @sizeOf(u32)) : (i += 1) { | 505 | while (i < alloc_size / @sizeOf(u32)) : (i += 1) { |
| ... | @@ -523,7 +523,7 @@ test "mmap" { | ... | @@ -523,7 +523,7 @@ test "mmap" { |
| 523 | defer os.munmap(data); | 523 | defer os.munmap(data); |
| 524 | 524 | ||
| 525 | var mem_stream = io.fixedBufferStream(data); | 525 | var mem_stream = io.fixedBufferStream(data); |
| 526 | const stream = mem_stream.inStream(); | 526 | const stream = mem_stream.reader(); |
| 527 | 527 | ||
| 528 | var i: u32 = alloc_size / 2 / @sizeOf(u32); | 528 | var i: u32 = alloc_size / 2 / @sizeOf(u32); |
| 529 | while (i < alloc_size / @sizeOf(u32)) : (i += 1) { | 529 | while (i < alloc_size / @sizeOf(u32)) : (i += 1) { |
lib/std/special/build_runner.zig+2-2| ... | @@ -57,8 +57,8 @@ pub fn main() !void { | ... | @@ -57,8 +57,8 @@ pub fn main() !void { |
| 57 | 57 | ||
| 58 | var targets = ArrayList([]const u8).init(allocator); | 58 | var targets = ArrayList([]const u8).init(allocator); |
| 59 | 59 | ||
| 60 | const stderr_stream = io.getStdErr().outStream(); | 60 | const stderr_stream = io.getStdErr().writer(); |
| 61 | const stdout_stream = io.getStdOut().outStream(); | 61 | const stdout_stream = io.getStdOut().writer(); |
| 62 | 62 | ||
| 63 | while (nextArg(args, &arg_idx)) |arg| { | 63 | while (nextArg(args, &arg_idx)) |arg| { |
| 64 | if (mem.startsWith(u8, arg, "-D")) { | 64 | if (mem.startsWith(u8, arg, "-D")) { |
lib/std/unicode/throughput_test.zig+1-1| ... | @@ -45,7 +45,7 @@ fn benchmarkCodepointCount(buf: []const u8) !ResultCount { | ... | @@ -45,7 +45,7 @@ fn benchmarkCodepointCount(buf: []const u8) !ResultCount { |
| 45 | } | 45 | } |
| 46 | 46 | ||
| 47 | pub fn main() !void { | 47 | pub fn main() !void { |
| 48 | const stdout = std.io.getStdOut().outStream(); | 48 | const stdout = std.io.getStdOut().writer(); |
| 49 | 49 | ||
| 50 | const args = try std.process.argsAlloc(std.heap.page_allocator); | 50 | const args = try std.process.argsAlloc(std.heap.page_allocator); |
| 51 | 51 |
lib/std/zig/cross_target.zig+7-7| ... | @@ -519,29 +519,29 @@ pub const CrossTarget = struct { | ... | @@ -519,29 +519,29 @@ pub const CrossTarget = struct { |
| 519 | var result = std.ArrayList(u8).init(allocator); | 519 | var result = std.ArrayList(u8).init(allocator); |
| 520 | defer result.deinit(); | 520 | defer result.deinit(); |
| 521 | 521 | ||
| 522 | try result.outStream().print("{s}-{s}", .{ arch_name, os_name }); | 522 | try result.writer().print("{s}-{s}", .{ arch_name, os_name }); |
| 523 | 523 | ||
| 524 | // The zig target syntax does not allow specifying a max os version with no min, so | 524 | // The zig target syntax does not allow specifying a max os version with no min, so |
| 525 | // if either are present, we need the min. | 525 | // if either are present, we need the min. |
| 526 | if (self.os_version_min != null or self.os_version_max != null) { | 526 | if (self.os_version_min != null or self.os_version_max != null) { |
| 527 | switch (self.getOsVersionMin()) { | 527 | switch (self.getOsVersionMin()) { |
| 528 | .none => {}, | 528 | .none => {}, |
| 529 | .semver => |v| try result.outStream().print(".{}", .{v}), | 529 | .semver => |v| try result.writer().print(".{}", .{v}), |
| 530 | .windows => |v| try result.outStream().print("{s}", .{v}), | 530 | .windows => |v| try result.writer().print("{s}", .{v}), |
| 531 | } | 531 | } |
| 532 | } | 532 | } |
| 533 | if (self.os_version_max) |max| { | 533 | if (self.os_version_max) |max| { |
| 534 | switch (max) { | 534 | switch (max) { |
| 535 | .none => {}, | 535 | .none => {}, |
| 536 | .semver => |v| try result.outStream().print("...{}", .{v}), | 536 | .semver => |v| try result.writer().print("...{}", .{v}), |
| 537 | .windows => |v| try result.outStream().print("..{s}", .{v}), | 537 | .windows => |v| try result.writer().print("..{s}", .{v}), |
| 538 | } | 538 | } |
| 539 | } | 539 | } |
| 540 | 540 | ||
| 541 | if (self.glibc_version) |v| { | 541 | if (self.glibc_version) |v| { |
| 542 | try result.outStream().print("-{s}.{}", .{ @tagName(self.getAbi()), v }); | 542 | try result.writer().print("-{s}.{}", .{ @tagName(self.getAbi()), v }); |
| 543 | } else if (self.abi) |abi| { | 543 | } else if (self.abi) |abi| { |
| 544 | try result.outStream().print("-{s}", .{@tagName(abi)}); | 544 | try result.writer().print("-{s}", .{@tagName(abi)}); |
| 545 | } | 545 | } |
| 546 | 546 | ||
| 547 | return result.toOwnedSlice(); | 547 | return result.toOwnedSlice(); |
lib/std/zig/parser_test.zig+3-3| ... | @@ -3734,7 +3734,7 @@ const maxInt = std.math.maxInt; | ... | @@ -3734,7 +3734,7 @@ const maxInt = std.math.maxInt; |
| 3734 | var fixed_buffer_mem: [100 * 1024]u8 = undefined; | 3734 | var fixed_buffer_mem: [100 * 1024]u8 = undefined; |
| 3735 | 3735 | ||
| 3736 | fn testParse(source: []const u8, allocator: *mem.Allocator, anything_changed: *bool) ![]u8 { | 3736 | fn testParse(source: []const u8, allocator: *mem.Allocator, anything_changed: *bool) ![]u8 { |
| 3737 | const stderr = io.getStdErr().outStream(); | 3737 | const stderr = io.getStdErr().writer(); |
| 3738 | 3738 | ||
| 3739 | const tree = try std.zig.parse(allocator, source); | 3739 | const tree = try std.zig.parse(allocator, source); |
| 3740 | defer tree.deinit(); | 3740 | defer tree.deinit(); |
| ... | @@ -3767,8 +3767,8 @@ fn testParse(source: []const u8, allocator: *mem.Allocator, anything_changed: *b | ... | @@ -3767,8 +3767,8 @@ fn testParse(source: []const u8, allocator: *mem.Allocator, anything_changed: *b |
| 3767 | var buffer = std.ArrayList(u8).init(allocator); | 3767 | var buffer = std.ArrayList(u8).init(allocator); |
| 3768 | errdefer buffer.deinit(); | 3768 | errdefer buffer.deinit(); |
| 3769 | 3769 | ||
| 3770 | const outStream = buffer.outStream(); | 3770 | const writer = buffer.writer(); |
| 3771 | anything_changed.* = try std.zig.render(allocator, outStream, tree); | 3771 | anything_changed.* = try std.zig.render(allocator, writer, tree); |
| 3772 | return buffer.toOwnedSlice(); | 3772 | return buffer.toOwnedSlice(); |
| 3773 | } | 3773 | } |
| 3774 | fn testTransform(source: []const u8, expected_source: []const u8) !void { | 3774 | fn testTransform(source: []const u8, expected_source: []const u8) !void { |
lib/std/zig/perf_test.zig+1-1| ... | @@ -29,7 +29,7 @@ pub fn main() !void { | ... | @@ -29,7 +29,7 @@ pub fn main() !void { |
| 29 | const mb_per_sec = bytes_per_sec / (1024 * 1024); | 29 | const mb_per_sec = bytes_per_sec / (1024 * 1024); |
| 30 | 30 | ||
| 31 | var stdout_file = std.io.getStdOut(); | 31 | var stdout_file = std.io.getStdOut(); |
| 32 | const stdout = stdout_file.outStream(); | 32 | const stdout = stdout_file.writer(); |
| 33 | try stdout.print("{:.3} MiB/s, {} KiB used \n", .{ mb_per_sec, memory_used / 1024 }); | 33 | try stdout.print("{:.3} MiB/s, {} KiB used \n", .{ mb_per_sec, memory_used / 1024 }); |
| 34 | } | 34 | } |
| 35 | 35 |
lib/std/zig/render.zig+2-2| ... | @@ -790,7 +790,7 @@ fn renderExpression( | ... | @@ -790,7 +790,7 @@ fn renderExpression( |
| 790 | const section_exprs = row_exprs[0..section_end]; | 790 | const section_exprs = row_exprs[0..section_end]; |
| 791 | 791 | ||
| 792 | // Null stream for counting the printed length of each expression | 792 | // Null stream for counting the printed length of each expression |
| 793 | var line_find_stream = std.io.findByteOutStream('\n', std.io.null_out_stream); | 793 | var line_find_stream = std.io.findByteOutStream('\n', std.io.null_writer); |
| 794 | var counting_stream = std.io.countingOutStream(line_find_stream.writer()); | 794 | var counting_stream = std.io.countingOutStream(line_find_stream.writer()); |
| 795 | var auto_indenting_stream = std.io.autoIndentingStream(indent_delta, counting_stream.writer()); | 795 | var auto_indenting_stream = std.io.autoIndentingStream(indent_delta, counting_stream.writer()); |
| 796 | 796 | ||
| ... | @@ -954,7 +954,7 @@ fn renderExpression( | ... | @@ -954,7 +954,7 @@ fn renderExpression( |
| 954 | const expr_outputs_one_line = blk: { | 954 | const expr_outputs_one_line = blk: { |
| 955 | // render field expressions until a LF is found | 955 | // render field expressions until a LF is found |
| 956 | for (field_inits) |field_init| { | 956 | for (field_inits) |field_init| { |
| 957 | var find_stream = std.io.findByteOutStream('\n', std.io.null_out_stream); | 957 | var find_stream = std.io.findByteOutStream('\n', std.io.null_writer); |
| 958 | var auto_indenting_stream = std.io.autoIndentingStream(indent_delta, find_stream.writer()); | 958 | var auto_indenting_stream = std.io.autoIndentingStream(indent_delta, find_stream.writer()); |
| 959 | 959 | ||
| 960 | try renderExpression(allocator, &auto_indenting_stream, tree, field_init, Space.None); | 960 | try renderExpression(allocator, &auto_indenting_stream, tree, field_init, Space.None); |
src/Cache.zig+1-1| ... | @@ -285,7 +285,7 @@ pub const Manifest = struct { | ... | @@ -285,7 +285,7 @@ pub const Manifest = struct { |
| 285 | }; | 285 | }; |
| 286 | } | 286 | } |
| 287 | 287 | ||
| 288 | const file_contents = try self.manifest_file.?.inStream().readAllAlloc(self.cache.gpa, manifest_file_size_max); | 288 | const file_contents = try self.manifest_file.?.reader().readAllAlloc(self.cache.gpa, manifest_file_size_max); |
| 289 | defer self.cache.gpa.free(file_contents); | 289 | defer self.cache.gpa.free(file_contents); |
| 290 | 290 | ||
| 291 | const input_file_count = self.files.items.len; | 291 | const input_file_count = self.files.items.len; |
src/Compilation.zig+4-4| ... | @@ -1820,7 +1820,7 @@ pub fn cImport(comp: *Compilation, c_src: []const u8) !CImportResult { | ... | @@ -1820,7 +1820,7 @@ pub fn cImport(comp: *Compilation, c_src: []const u8) !CImportResult { |
| 1820 | var out_zig_file = try o_dir.createFile(cimport_zig_basename, .{}); | 1820 | var out_zig_file = try o_dir.createFile(cimport_zig_basename, .{}); |
| 1821 | defer out_zig_file.close(); | 1821 | defer out_zig_file.close(); |
| 1822 | 1822 | ||
| 1823 | var bos = std.io.bufferedOutStream(out_zig_file.writer()); | 1823 | var bos = std.io.bufferedWriter(out_zig_file.writer()); |
| 1824 | _ = try std.zig.render(comp.gpa, bos.writer(), tree); | 1824 | _ = try std.zig.render(comp.gpa, bos.writer(), tree); |
| 1825 | try bos.flush(); | 1825 | try bos.flush(); |
| 1826 | 1826 | ||
| ... | @@ -2750,7 +2750,7 @@ pub fn generateBuiltinZigSource(comp: *Compilation, allocator: *Allocator) ![]u8 | ... | @@ -2750,7 +2750,7 @@ pub fn generateBuiltinZigSource(comp: *Compilation, allocator: *Allocator) ![]u8 |
| 2750 | 2750 | ||
| 2751 | switch (target.os.getVersionRange()) { | 2751 | switch (target.os.getVersionRange()) { |
| 2752 | .none => try buffer.appendSlice(" .none = {} }\n"), | 2752 | .none => try buffer.appendSlice(" .none = {} }\n"), |
| 2753 | .semver => |semver| try buffer.outStream().print( | 2753 | .semver => |semver| try buffer.writer().print( |
| 2754 | \\ .semver = .{{ | 2754 | \\ .semver = .{{ |
| 2755 | \\ .min = .{{ | 2755 | \\ .min = .{{ |
| 2756 | \\ .major = {}, | 2756 | \\ .major = {}, |
| ... | @@ -2773,7 +2773,7 @@ pub fn generateBuiltinZigSource(comp: *Compilation, allocator: *Allocator) ![]u8 | ... | @@ -2773,7 +2773,7 @@ pub fn generateBuiltinZigSource(comp: *Compilation, allocator: *Allocator) ![]u8 |
| 2773 | semver.max.minor, | 2773 | semver.max.minor, |
| 2774 | semver.max.patch, | 2774 | semver.max.patch, |
| 2775 | }), | 2775 | }), |
| 2776 | .linux => |linux| try buffer.outStream().print( | 2776 | .linux => |linux| try buffer.writer().print( |
| 2777 | \\ .linux = .{{ | 2777 | \\ .linux = .{{ |
| 2778 | \\ .range = .{{ | 2778 | \\ .range = .{{ |
| 2779 | \\ .min = .{{ | 2779 | \\ .min = .{{ |
| ... | @@ -2807,7 +2807,7 @@ pub fn generateBuiltinZigSource(comp: *Compilation, allocator: *Allocator) ![]u8 | ... | @@ -2807,7 +2807,7 @@ pub fn generateBuiltinZigSource(comp: *Compilation, allocator: *Allocator) ![]u8 |
| 2807 | linux.glibc.minor, | 2807 | linux.glibc.minor, |
| 2808 | linux.glibc.patch, | 2808 | linux.glibc.patch, |
| 2809 | }), | 2809 | }), |
| 2810 | .windows => |windows| try buffer.outStream().print( | 2810 | .windows => |windows| try buffer.writer().print( |
| 2811 | \\ .windows = .{{ | 2811 | \\ .windows = .{{ |
| 2812 | \\ .min = {s}, | 2812 | \\ .min = {s}, |
| 2813 | \\ .max = {s}, | 2813 | \\ .max = {s}, |
src/DepTokenizer.zig+1-1| ... | @@ -910,7 +910,7 @@ fn depTokenizer(input: []const u8, expect: []const u8) !void { | ... | @@ -910,7 +910,7 @@ fn depTokenizer(input: []const u8, expect: []const u8) !void { |
| 910 | }, | 910 | }, |
| 911 | else => { | 911 | else => { |
| 912 | try buffer.appendSlice("ERROR: "); | 912 | try buffer.appendSlice("ERROR: "); |
| 913 | try token.printError(buffer.outStream()); | 913 | try token.printError(buffer.writer()); |
| 914 | break; | 914 | break; |
| 915 | }, | 915 | }, |
| 916 | } | 916 | } |
src/Module.zig+1-1| ... | @@ -1649,7 +1649,7 @@ pub fn getAstTree(self: *Module, root_scope: *Scope.File) !*ast.Tree { | ... | @@ -1649,7 +1649,7 @@ pub fn getAstTree(self: *Module, root_scope: *Scope.File) !*ast.Tree { |
| 1649 | var msg = std.ArrayList(u8).init(self.gpa); | 1649 | var msg = std.ArrayList(u8).init(self.gpa); |
| 1650 | defer msg.deinit(); | 1650 | defer msg.deinit(); |
| 1651 | 1651 | ||
| 1652 | try parse_err.render(tree.token_ids, msg.outStream()); | 1652 | try parse_err.render(tree.token_ids, msg.writer()); |
| 1653 | const err_msg = try self.gpa.create(Compilation.ErrorMsg); | 1653 | const err_msg = try self.gpa.create(Compilation.ErrorMsg); |
| 1654 | err_msg.* = .{ | 1654 | err_msg.* = .{ |
| 1655 | .msg = msg.toOwnedSlice(), | 1655 | .msg = msg.toOwnedSlice(), |
src/codegen/llvm.zig+4-4| ... | @@ -200,7 +200,7 @@ pub const LLVMIRModule = struct { | ... | @@ -200,7 +200,7 @@ pub const LLVMIRModule = struct { |
| 200 | if (llvm.Target.getFromTriple(llvm_target_triple.ptr, &target, &error_message)) { | 200 | if (llvm.Target.getFromTriple(llvm_target_triple.ptr, &target, &error_message)) { |
| 201 | defer llvm.disposeMessage(error_message); | 201 | defer llvm.disposeMessage(error_message); |
| 202 | 202 | ||
| 203 | const stderr = std.io.getStdErr().outStream(); | 203 | const stderr = std.io.getStdErr().writer(); |
| 204 | try stderr.print( | 204 | try stderr.print( |
| 205 | \\Zig is expecting LLVM to understand this target: '{s}' | 205 | \\Zig is expecting LLVM to understand this target: '{s}' |
| 206 | \\However LLVM responded with: "{s}" | 206 | \\However LLVM responded with: "{s}" |
| ... | @@ -268,7 +268,7 @@ pub const LLVMIRModule = struct { | ... | @@ -268,7 +268,7 @@ pub const LLVMIRModule = struct { |
| 268 | const dump = self.llvm_module.printToString(); | 268 | const dump = self.llvm_module.printToString(); |
| 269 | defer llvm.disposeMessage(dump); | 269 | defer llvm.disposeMessage(dump); |
| 270 | 270 | ||
| 271 | const stderr = std.io.getStdErr().outStream(); | 271 | const stderr = std.io.getStdErr().writer(); |
| 272 | try stderr.writeAll(std.mem.spanZ(dump)); | 272 | try stderr.writeAll(std.mem.spanZ(dump)); |
| 273 | } | 273 | } |
| 274 | 274 | ||
| ... | @@ -278,7 +278,7 @@ pub const LLVMIRModule = struct { | ... | @@ -278,7 +278,7 @@ pub const LLVMIRModule = struct { |
| 278 | defer llvm.disposeMessage(error_message); | 278 | defer llvm.disposeMessage(error_message); |
| 279 | 279 | ||
| 280 | if (self.llvm_module.verify(.ReturnStatus, &error_message)) { | 280 | if (self.llvm_module.verify(.ReturnStatus, &error_message)) { |
| 281 | const stderr = std.io.getStdErr().outStream(); | 281 | const stderr = std.io.getStdErr().writer(); |
| 282 | try stderr.print("broken LLVM module found: {s}\nThis is a bug in the Zig compiler.", .{error_message}); | 282 | try stderr.print("broken LLVM module found: {s}\nThis is a bug in the Zig compiler.", .{error_message}); |
| 283 | return error.BrokenLLVMModule; | 283 | return error.BrokenLLVMModule; |
| 284 | } | 284 | } |
| ... | @@ -296,7 +296,7 @@ pub const LLVMIRModule = struct { | ... | @@ -296,7 +296,7 @@ pub const LLVMIRModule = struct { |
| 296 | )) { | 296 | )) { |
| 297 | defer llvm.disposeMessage(error_message); | 297 | defer llvm.disposeMessage(error_message); |
| 298 | 298 | ||
| 299 | const stderr = std.io.getStdErr().outStream(); | 299 | const stderr = std.io.getStdErr().writer(); |
| 300 | try stderr.print("LLVM failed to emit file: {s}\n", .{error_message}); | 300 | try stderr.print("LLVM failed to emit file: {s}\n", .{error_message}); |
| 301 | return error.FailedToEmit; | 301 | return error.FailedToEmit; |
| 302 | } | 302 | } |
src/libc_installation.zig+3-3| ... | @@ -338,7 +338,7 @@ pub const LibCInstallation = struct { | ... | @@ -338,7 +338,7 @@ pub const LibCInstallation = struct { |
| 338 | 338 | ||
| 339 | for (searches) |search| { | 339 | for (searches) |search| { |
| 340 | result_buf.shrinkAndFree(0); | 340 | result_buf.shrinkAndFree(0); |
| 341 | try result_buf.outStream().print("{s}\\Include\\{s}\\ucrt", .{ search.path, search.version }); | 341 | try result_buf.writer().print("{s}\\Include\\{s}\\ucrt", .{ search.path, search.version }); |
| 342 | 342 | ||
| 343 | var dir = fs.cwd().openDir(result_buf.items, .{}) catch |err| switch (err) { | 343 | var dir = fs.cwd().openDir(result_buf.items, .{}) catch |err| switch (err) { |
| 344 | error.FileNotFound, | 344 | error.FileNotFound, |
| ... | @@ -384,7 +384,7 @@ pub const LibCInstallation = struct { | ... | @@ -384,7 +384,7 @@ pub const LibCInstallation = struct { |
| 384 | 384 | ||
| 385 | for (searches) |search| { | 385 | for (searches) |search| { |
| 386 | result_buf.shrinkAndFree(0); | 386 | result_buf.shrinkAndFree(0); |
| 387 | try result_buf.outStream().print("{s}\\Lib\\{s}\\ucrt\\{s}", .{ search.path, search.version, arch_sub_dir }); | 387 | try result_buf.writer().print("{s}\\Lib\\{s}\\ucrt\\{s}", .{ search.path, search.version, arch_sub_dir }); |
| 388 | 388 | ||
| 389 | var dir = fs.cwd().openDir(result_buf.items, .{}) catch |err| switch (err) { | 389 | var dir = fs.cwd().openDir(result_buf.items, .{}) catch |err| switch (err) { |
| 390 | error.FileNotFound, | 390 | error.FileNotFound, |
| ... | @@ -438,7 +438,7 @@ pub const LibCInstallation = struct { | ... | @@ -438,7 +438,7 @@ pub const LibCInstallation = struct { |
| 438 | 438 | ||
| 439 | for (searches) |search| { | 439 | for (searches) |search| { |
| 440 | result_buf.shrinkAndFree(0); | 440 | result_buf.shrinkAndFree(0); |
| 441 | const stream = result_buf.outStream(); | 441 | const stream = result_buf.writer(); |
| 442 | try stream.print("{s}\\Lib\\{s}\\um\\{s}", .{ search.path, search.version, arch_sub_dir }); | 442 | try stream.print("{s}\\Lib\\{s}\\um\\{s}", .{ search.path, search.version, arch_sub_dir }); |
| 443 | 443 | ||
| 444 | var dir = fs.cwd().openDir(result_buf.items, .{}) catch |err| switch (err) { | 444 | var dir = fs.cwd().openDir(result_buf.items, .{}) catch |err| switch (err) { |
src/main.zig+19-19| ... | @@ -196,7 +196,7 @@ pub fn mainArgs(gpa: *Allocator, arena: *Allocator, args: []const []const u8) !v | ... | @@ -196,7 +196,7 @@ pub fn mainArgs(gpa: *Allocator, arena: *Allocator, args: []const []const u8) !v |
| 196 | return cmdInit(gpa, arena, cmd_args, .Lib); | 196 | return cmdInit(gpa, arena, cmd_args, .Lib); |
| 197 | } else if (mem.eql(u8, cmd, "targets")) { | 197 | } else if (mem.eql(u8, cmd, "targets")) { |
| 198 | const info = try detectNativeTargetInfo(arena, .{}); | 198 | const info = try detectNativeTargetInfo(arena, .{}); |
| 199 | const stdout = io.getStdOut().outStream(); | 199 | const stdout = io.getStdOut().writer(); |
| 200 | return @import("print_targets.zig").cmdTargets(arena, cmd_args, stdout, info.target); | 200 | return @import("print_targets.zig").cmdTargets(arena, cmd_args, stdout, info.target); |
| 201 | } else if (mem.eql(u8, cmd, "version")) { | 201 | } else if (mem.eql(u8, cmd, "version")) { |
| 202 | try std.io.getStdOut().writeAll(build_options.version ++ "\n"); | 202 | try std.io.getStdOut().writeAll(build_options.version ++ "\n"); |
| ... | @@ -1944,8 +1944,8 @@ fn buildOutputType( | ... | @@ -1944,8 +1944,8 @@ fn buildOutputType( |
| 1944 | } | 1944 | } |
| 1945 | } | 1945 | } |
| 1946 | 1946 | ||
| 1947 | const stdin = std.io.getStdIn().inStream(); | 1947 | const stdin = std.io.getStdIn().reader(); |
| 1948 | const stderr = std.io.getStdErr().outStream(); | 1948 | const stderr = std.io.getStdErr().writer(); |
| 1949 | var repl_buf: [1024]u8 = undefined; | 1949 | var repl_buf: [1024]u8 = undefined; |
| 1950 | 1950 | ||
| 1951 | while (watch) { | 1951 | while (watch) { |
| ... | @@ -2114,9 +2114,9 @@ fn cmdTranslateC(comp: *Compilation, arena: *Allocator, enable_cache: bool) !voi | ... | @@ -2114,9 +2114,9 @@ fn cmdTranslateC(comp: *Compilation, arena: *Allocator, enable_cache: bool) !voi |
| 2114 | var zig_file = try o_dir.createFile(translated_zig_basename, .{}); | 2114 | var zig_file = try o_dir.createFile(translated_zig_basename, .{}); |
| 2115 | defer zig_file.close(); | 2115 | defer zig_file.close(); |
| 2116 | 2116 | ||
| 2117 | var bos = io.bufferedOutStream(zig_file.writer()); | 2117 | var bw = io.bufferedWriter(zig_file.writer()); |
| 2118 | _ = try std.zig.render(comp.gpa, bos.writer(), tree); | 2118 | _ = try std.zig.render(comp.gpa, bw.writer(), tree); |
| 2119 | try bos.flush(); | 2119 | try bw.flush(); |
| 2120 | 2120 | ||
| 2121 | man.writeManifest() catch |err| warn("failed to write cache manifest: {s}", .{@errorName(err)}); | 2121 | man.writeManifest() catch |err| warn("failed to write cache manifest: {s}", .{@errorName(err)}); |
| 2122 | 2122 | ||
| ... | @@ -2187,9 +2187,9 @@ pub fn cmdLibC(gpa: *Allocator, args: []const []const u8) !void { | ... | @@ -2187,9 +2187,9 @@ pub fn cmdLibC(gpa: *Allocator, args: []const []const u8) !void { |
| 2187 | }; | 2187 | }; |
| 2188 | defer libc.deinit(gpa); | 2188 | defer libc.deinit(gpa); |
| 2189 | 2189 | ||
| 2190 | var bos = io.bufferedOutStream(io.getStdOut().writer()); | 2190 | var bw = io.bufferedWriter(io.getStdOut().writer()); |
| 2191 | try libc.render(bos.writer()); | 2191 | try libc.render(bw.writer()); |
| 2192 | try bos.flush(); | 2192 | try bw.flush(); |
| 2193 | } | 2193 | } |
| 2194 | } | 2194 | } |
| 2195 | 2195 | ||
| ... | @@ -2570,7 +2570,7 @@ pub fn cmdFmt(gpa: *Allocator, args: []const []const u8) !void { | ... | @@ -2570,7 +2570,7 @@ pub fn cmdFmt(gpa: *Allocator, args: []const []const u8) !void { |
| 2570 | const arg = args[i]; | 2570 | const arg = args[i]; |
| 2571 | if (mem.startsWith(u8, arg, "-")) { | 2571 | if (mem.startsWith(u8, arg, "-")) { |
| 2572 | if (mem.eql(u8, arg, "-h") or mem.eql(u8, arg, "--help")) { | 2572 | if (mem.eql(u8, arg, "-h") or mem.eql(u8, arg, "--help")) { |
| 2573 | const stdout = io.getStdOut().outStream(); | 2573 | const stdout = io.getStdOut().writer(); |
| 2574 | try stdout.writeAll(usage_fmt); | 2574 | try stdout.writeAll(usage_fmt); |
| 2575 | return cleanExit(); | 2575 | return cleanExit(); |
| 2576 | } else if (mem.eql(u8, arg, "--color")) { | 2576 | } else if (mem.eql(u8, arg, "--color")) { |
| ... | @@ -2600,7 +2600,7 @@ pub fn cmdFmt(gpa: *Allocator, args: []const []const u8) !void { | ... | @@ -2600,7 +2600,7 @@ pub fn cmdFmt(gpa: *Allocator, args: []const []const u8) !void { |
| 2600 | fatal("cannot use --stdin with positional arguments", .{}); | 2600 | fatal("cannot use --stdin with positional arguments", .{}); |
| 2601 | } | 2601 | } |
| 2602 | 2602 | ||
| 2603 | const stdin = io.getStdIn().inStream(); | 2603 | const stdin = io.getStdIn().reader(); |
| 2604 | 2604 | ||
| 2605 | const source_code = try stdin.readAllAlloc(gpa, max_src_size); | 2605 | const source_code = try stdin.readAllAlloc(gpa, max_src_size); |
| 2606 | defer gpa.free(source_code); | 2606 | defer gpa.free(source_code); |
| ... | @@ -2617,14 +2617,14 @@ pub fn cmdFmt(gpa: *Allocator, args: []const []const u8) !void { | ... | @@ -2617,14 +2617,14 @@ pub fn cmdFmt(gpa: *Allocator, args: []const []const u8) !void { |
| 2617 | process.exit(1); | 2617 | process.exit(1); |
| 2618 | } | 2618 | } |
| 2619 | if (check_flag) { | 2619 | if (check_flag) { |
| 2620 | const anything_changed = try std.zig.render(gpa, io.null_out_stream, tree); | 2620 | const anything_changed = try std.zig.render(gpa, io.null_writer, tree); |
| 2621 | const code = if (anything_changed) @as(u8, 1) else @as(u8, 0); | 2621 | const code = if (anything_changed) @as(u8, 1) else @as(u8, 0); |
| 2622 | process.exit(code); | 2622 | process.exit(code); |
| 2623 | } | 2623 | } |
| 2624 | 2624 | ||
| 2625 | var bos = io.bufferedOutStream(io.getStdOut().writer()); | 2625 | var bw = io.bufferedWriter(io.getStdOut().writer()); |
| 2626 | _ = try std.zig.render(gpa, bos.writer(), tree); | 2626 | _ = try std.zig.render(gpa, bw.writer(), tree); |
| 2627 | try bos.flush(); | 2627 | try bw.flush(); |
| 2628 | return; | 2628 | return; |
| 2629 | } | 2629 | } |
| 2630 | 2630 | ||
| ... | @@ -2774,7 +2774,7 @@ fn fmtPathFile( | ... | @@ -2774,7 +2774,7 @@ fn fmtPathFile( |
| 2774 | } | 2774 | } |
| 2775 | 2775 | ||
| 2776 | if (check_mode) { | 2776 | if (check_mode) { |
| 2777 | const anything_changed = try std.zig.render(fmt.gpa, io.null_out_stream, tree); | 2777 | const anything_changed = try std.zig.render(fmt.gpa, io.null_writer, tree); |
| 2778 | if (anything_changed) { | 2778 | if (anything_changed) { |
| 2779 | const stdout = io.getStdOut().writer(); | 2779 | const stdout = io.getStdOut().writer(); |
| 2780 | try stdout.print("{s}\n", .{file_path}); | 2780 | try stdout.print("{s}\n", .{file_path}); |
| ... | @@ -2823,11 +2823,11 @@ fn printErrMsgToFile( | ... | @@ -2823,11 +2823,11 @@ fn printErrMsgToFile( |
| 2823 | 2823 | ||
| 2824 | var text_buf = std.ArrayList(u8).init(gpa); | 2824 | var text_buf = std.ArrayList(u8).init(gpa); |
| 2825 | defer text_buf.deinit(); | 2825 | defer text_buf.deinit(); |
| 2826 | const out_stream = text_buf.outStream(); | 2826 | const writer = text_buf.writer(); |
| 2827 | try parse_error.render(tree.token_ids, out_stream); | 2827 | try parse_error.render(tree.token_ids, writer); |
| 2828 | const text = text_buf.items; | 2828 | const text = text_buf.items; |
| 2829 | 2829 | ||
| 2830 | const stream = file.outStream(); | 2830 | const stream = file.writer(); |
| 2831 | try stream.print("{s}:{d}:{d}: error: {s}\n", .{ path, start_loc.line + 1, start_loc.column + 1, text }); | 2831 | try stream.print("{s}:{d}:{d}: error: {s}\n", .{ path, start_loc.line + 1, start_loc.column + 1, text }); |
| 2832 | 2832 | ||
| 2833 | if (!color_on) return; | 2833 | if (!color_on) return; |
src/print_env.zig+5-5| ... | @@ -20,10 +20,10 @@ pub fn cmdEnv(gpa: *Allocator, args: []const []const u8, stdout: std.fs.File.Wri | ... | @@ -20,10 +20,10 @@ pub fn cmdEnv(gpa: *Allocator, args: []const []const u8, stdout: std.fs.File.Wri |
| 20 | const global_cache_dir = try introspect.resolveGlobalCacheDir(gpa); | 20 | const global_cache_dir = try introspect.resolveGlobalCacheDir(gpa); |
| 21 | defer gpa.free(global_cache_dir); | 21 | defer gpa.free(global_cache_dir); |
| 22 | 22 | ||
| 23 | var bos = std.io.bufferedOutStream(stdout); | 23 | var bw = std.io.bufferedWriter(stdout); |
| 24 | const bos_stream = bos.outStream(); | 24 | const w = bw.writer(); |
| 25 | 25 | ||
| 26 | var jws = std.json.WriteStream(@TypeOf(bos_stream), 6).init(bos_stream); | 26 | var jws = std.json.WriteStream(@TypeOf(w), 6).init(w); |
| 27 | try jws.beginObject(); | 27 | try jws.beginObject(); |
| 28 | 28 | ||
| 29 | try jws.objectField("zig_exe"); | 29 | try jws.objectField("zig_exe"); |
| ... | @@ -42,6 +42,6 @@ pub fn cmdEnv(gpa: *Allocator, args: []const []const u8, stdout: std.fs.File.Wri | ... | @@ -42,6 +42,6 @@ pub fn cmdEnv(gpa: *Allocator, args: []const []const u8, stdout: std.fs.File.Wri |
| 42 | try jws.emitString(build_options.version); | 42 | try jws.emitString(build_options.version); |
| 43 | 43 | ||
| 44 | try jws.endObject(); | 44 | try jws.endObject(); |
| 45 | try bos_stream.writeByte('\n'); | 45 | try w.writeByte('\n'); |
| 46 | try bos.flush(); | 46 | try bw.flush(); |
| 47 | } | 47 | } |
src/print_targets.zig+5-5| ... | @@ -26,9 +26,9 @@ pub fn cmdTargets( | ... | @@ -26,9 +26,9 @@ pub fn cmdTargets( |
| 26 | const glibc_abi = try glibc.loadMetaData(allocator, zig_lib_directory.handle); | 26 | const glibc_abi = try glibc.loadMetaData(allocator, zig_lib_directory.handle); |
| 27 | defer glibc_abi.destroy(allocator); | 27 | defer glibc_abi.destroy(allocator); |
| 28 | 28 | ||
| 29 | var bos = io.bufferedOutStream(stdout); | 29 | var bw = io.bufferedWriter(stdout); |
| 30 | const bos_stream = bos.outStream(); | 30 | const w = bw.writer(); |
| 31 | var jws = std.json.WriteStream(@TypeOf(bos_stream), 6).init(bos_stream); | 31 | var jws = std.json.WriteStream(@TypeOf(w), 6).init(w); |
| 32 | 32 | ||
| 33 | try jws.beginObject(); | 33 | try jws.beginObject(); |
| 34 | 34 | ||
| ... | @@ -156,6 +156,6 @@ pub fn cmdTargets( | ... | @@ -156,6 +156,6 @@ pub fn cmdTargets( |
| 156 | 156 | ||
| 157 | try jws.endObject(); | 157 | try jws.endObject(); |
| 158 | 158 | ||
| 159 | try bos_stream.writeByte('\n'); | 159 | try w.writeByte('\n'); |
| 160 | return bos.flush(); | 160 | return bw.flush(); |
| 161 | } | 161 | } |
src/test.zig+1-1| ... | @@ -738,7 +738,7 @@ pub const TestContext = struct { | ... | @@ -738,7 +738,7 @@ pub const TestContext = struct { |
| 738 | write_node.activate(); | 738 | write_node.activate(); |
| 739 | var out_zir = std.ArrayList(u8).init(allocator); | 739 | var out_zir = std.ArrayList(u8).init(allocator); |
| 740 | defer out_zir.deinit(); | 740 | defer out_zir.deinit(); |
| 741 | try new_zir_module.writeToStream(allocator, out_zir.outStream()); | 741 | try new_zir_module.writeToStream(allocator, out_zir.writer()); |
| 742 | write_node.end(); | 742 | write_node.end(); |
| 743 | 743 | ||
| 744 | var test_node = update_node.start("assert", 0); | 744 | var test_node = update_node.start("assert", 0); |
src/translate_c.zig+1-1| ... | @@ -5268,7 +5268,7 @@ fn appendTokenFmt(c: *Context, token_id: Token.Id, comptime format: []const u8, | ... | @@ -5268,7 +5268,7 @@ fn appendTokenFmt(c: *Context, token_id: Token.Id, comptime format: []const u8, |
| 5268 | try c.token_locs.ensureCapacity(c.gpa, c.token_locs.items.len + 1); | 5268 | try c.token_locs.ensureCapacity(c.gpa, c.token_locs.items.len + 1); |
| 5269 | 5269 | ||
| 5270 | const start_index = c.source_buffer.items.len; | 5270 | const start_index = c.source_buffer.items.len; |
| 5271 | try c.source_buffer.outStream().print(format ++ " ", args); | 5271 | try c.source_buffer.writer().print(format ++ " ", args); |
| 5272 | 5272 | ||
| 5273 | c.token_ids.appendAssumeCapacity(token_id); | 5273 | c.token_ids.appendAssumeCapacity(token_id); |
| 5274 | c.token_locs.appendAssumeCapacity(.{ | 5274 | c.token_locs.appendAssumeCapacity(.{ |
src/zir.zig+2-2| ... | @@ -1116,7 +1116,7 @@ pub const Module = struct { | ... | @@ -1116,7 +1116,7 @@ pub const Module = struct { |
| 1116 | 1116 | ||
| 1117 | /// This is a debugging utility for rendering the tree to stderr. | 1117 | /// This is a debugging utility for rendering the tree to stderr. |
| 1118 | pub fn dump(self: Module) void { | 1118 | pub fn dump(self: Module) void { |
| 1119 | self.writeToStream(std.heap.page_allocator, std.io.getStdErr().outStream()) catch {}; | 1119 | self.writeToStream(std.heap.page_allocator, std.io.getStdErr().writer()) catch {}; |
| 1120 | } | 1120 | } |
| 1121 | 1121 | ||
| 1122 | const DeclAndIndex = struct { | 1122 | const DeclAndIndex = struct { |
| ... | @@ -3254,7 +3254,7 @@ pub fn dumpZir(allocator: *Allocator, kind: []const u8, decl_name: [*:0]const u8 | ... | @@ -3254,7 +3254,7 @@ pub fn dumpZir(allocator: *Allocator, kind: []const u8, decl_name: [*:0]const u8 |
| 3254 | 3254 | ||
| 3255 | try write.inst_table.ensureCapacity(@intCast(u32, instructions.len)); | 3255 | try write.inst_table.ensureCapacity(@intCast(u32, instructions.len)); |
| 3256 | 3256 | ||
| 3257 | const stderr = std.io.getStdErr().outStream(); | 3257 | const stderr = std.io.getStdErr().writer(); |
| 3258 | try stderr.print("{s} {s} {{ // unanalyzed\n", .{ kind, decl_name }); | 3258 | try stderr.print("{s} {s} {{ // unanalyzed\n", .{ kind, decl_name }); |
| 3259 | 3259 | ||
| 3260 | for (instructions) |inst| { | 3260 | for (instructions) |inst| { |
test/compare_output.zig+15-15| ... | @@ -22,7 +22,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void { | ... | @@ -22,7 +22,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void { |
| 22 | \\ | 22 | \\ |
| 23 | \\pub fn main() void { | 23 | \\pub fn main() void { |
| 24 | \\ privateFunction(); | 24 | \\ privateFunction(); |
| 25 | \\ const stdout = getStdOut().outStream(); | 25 | \\ const stdout = getStdOut().writer(); |
| 26 | \\ stdout.print("OK 2\n", .{}) catch unreachable; | 26 | \\ stdout.print("OK 2\n", .{}) catch unreachable; |
| 27 | \\} | 27 | \\} |
| 28 | \\ | 28 | \\ |
| ... | @@ -37,7 +37,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void { | ... | @@ -37,7 +37,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void { |
| 37 | \\// purposefully conflicting function with main.zig | 37 | \\// purposefully conflicting function with main.zig |
| 38 | \\// but it's private so it should be OK | 38 | \\// but it's private so it should be OK |
| 39 | \\fn privateFunction() void { | 39 | \\fn privateFunction() void { |
| 40 | \\ const stdout = getStdOut().outStream(); | 40 | \\ const stdout = getStdOut().writer(); |
| 41 | \\ stdout.print("OK 1\n", .{}) catch unreachable; | 41 | \\ stdout.print("OK 1\n", .{}) catch unreachable; |
| 42 | \\} | 42 | \\} |
| 43 | \\ | 43 | \\ |
| ... | @@ -63,7 +63,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void { | ... | @@ -63,7 +63,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void { |
| 63 | tc.addSourceFile("foo.zig", | 63 | tc.addSourceFile("foo.zig", |
| 64 | \\usingnamespace @import("std").io; | 64 | \\usingnamespace @import("std").io; |
| 65 | \\pub fn foo_function() void { | 65 | \\pub fn foo_function() void { |
| 66 | \\ const stdout = getStdOut().outStream(); | 66 | \\ const stdout = getStdOut().writer(); |
| 67 | \\ stdout.print("OK\n", .{}) catch unreachable; | 67 | \\ stdout.print("OK\n", .{}) catch unreachable; |
| 68 | \\} | 68 | \\} |
| 69 | ); | 69 | ); |
| ... | @@ -74,7 +74,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void { | ... | @@ -74,7 +74,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void { |
| 74 | \\ | 74 | \\ |
| 75 | \\pub fn bar_function() void { | 75 | \\pub fn bar_function() void { |
| 76 | \\ if (foo_function()) { | 76 | \\ if (foo_function()) { |
| 77 | \\ const stdout = getStdOut().outStream(); | 77 | \\ const stdout = getStdOut().writer(); |
| 78 | \\ stdout.print("OK\n", .{}) catch unreachable; | 78 | \\ stdout.print("OK\n", .{}) catch unreachable; |
| 79 | \\ } | 79 | \\ } |
| 80 | \\} | 80 | \\} |
| ... | @@ -106,7 +106,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void { | ... | @@ -106,7 +106,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void { |
| 106 | \\pub const a_text = "OK\n"; | 106 | \\pub const a_text = "OK\n"; |
| 107 | \\ | 107 | \\ |
| 108 | \\pub fn ok() void { | 108 | \\pub fn ok() void { |
| 109 | \\ const stdout = io.getStdOut().outStream(); | 109 | \\ const stdout = io.getStdOut().writer(); |
| 110 | \\ stdout.print(b_text, .{}) catch unreachable; | 110 | \\ stdout.print(b_text, .{}) catch unreachable; |
| 111 | \\} | 111 | \\} |
| 112 | ); | 112 | ); |
| ... | @@ -124,7 +124,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void { | ... | @@ -124,7 +124,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void { |
| 124 | \\const io = @import("std").io; | 124 | \\const io = @import("std").io; |
| 125 | \\ | 125 | \\ |
| 126 | \\pub fn main() void { | 126 | \\pub fn main() void { |
| 127 | \\ const stdout = io.getStdOut().outStream(); | 127 | \\ const stdout = io.getStdOut().writer(); |
| 128 | \\ stdout.print("Hello, world!\n{d:4} {x:3} {c}\n", .{@as(u32, 12), @as(u16, 0x12), @as(u8, 'a')}) catch unreachable; | 128 | \\ stdout.print("Hello, world!\n{d:4} {x:3} {c}\n", .{@as(u32, 12), @as(u16, 0x12), @as(u8, 'a')}) catch unreachable; |
| 129 | \\} | 129 | \\} |
| 130 | , "Hello, world!\n 12 12 a\n"); | 130 | , "Hello, world!\n 12 12 a\n"); |
| ... | @@ -267,7 +267,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void { | ... | @@ -267,7 +267,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void { |
| 267 | \\ var x_local : i32 = print_ok(x); | 267 | \\ var x_local : i32 = print_ok(x); |
| 268 | \\} | 268 | \\} |
| 269 | \\fn print_ok(val: @TypeOf(x)) @TypeOf(foo) { | 269 | \\fn print_ok(val: @TypeOf(x)) @TypeOf(foo) { |
| 270 | \\ const stdout = io.getStdOut().outStream(); | 270 | \\ const stdout = io.getStdOut().writer(); |
| 271 | \\ stdout.print("OK\n", .{}) catch unreachable; | 271 | \\ stdout.print("OK\n", .{}) catch unreachable; |
| 272 | \\ return 0; | 272 | \\ return 0; |
| 273 | \\} | 273 | \\} |
| ... | @@ -349,7 +349,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void { | ... | @@ -349,7 +349,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void { |
| 349 | \\pub fn main() void { | 349 | \\pub fn main() void { |
| 350 | \\ const bar = Bar {.field2 = 13,}; | 350 | \\ const bar = Bar {.field2 = 13,}; |
| 351 | \\ const foo = Foo {.field1 = bar,}; | 351 | \\ const foo = Foo {.field1 = bar,}; |
| 352 | \\ const stdout = io.getStdOut().outStream(); | 352 | \\ const stdout = io.getStdOut().writer(); |
| 353 | \\ if (!foo.method()) { | 353 | \\ if (!foo.method()) { |
| 354 | \\ stdout.print("BAD\n", .{}) catch unreachable; | 354 | \\ stdout.print("BAD\n", .{}) catch unreachable; |
| 355 | \\ } | 355 | \\ } |
| ... | @@ -363,7 +363,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void { | ... | @@ -363,7 +363,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void { |
| 363 | cases.add("defer with only fallthrough", | 363 | cases.add("defer with only fallthrough", |
| 364 | \\const io = @import("std").io; | 364 | \\const io = @import("std").io; |
| 365 | \\pub fn main() void { | 365 | \\pub fn main() void { |
| 366 | \\ const stdout = io.getStdOut().outStream(); | 366 | \\ const stdout = io.getStdOut().writer(); |
| 367 | \\ stdout.print("before\n", .{}) catch unreachable; | 367 | \\ stdout.print("before\n", .{}) catch unreachable; |
| 368 | \\ defer stdout.print("defer1\n", .{}) catch unreachable; | 368 | \\ defer stdout.print("defer1\n", .{}) catch unreachable; |
| 369 | \\ defer stdout.print("defer2\n", .{}) catch unreachable; | 369 | \\ defer stdout.print("defer2\n", .{}) catch unreachable; |
| ... | @@ -376,7 +376,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void { | ... | @@ -376,7 +376,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void { |
| 376 | \\const io = @import("std").io; | 376 | \\const io = @import("std").io; |
| 377 | \\const os = @import("std").os; | 377 | \\const os = @import("std").os; |
| 378 | \\pub fn main() void { | 378 | \\pub fn main() void { |
| 379 | \\ const stdout = io.getStdOut().outStream(); | 379 | \\ const stdout = io.getStdOut().writer(); |
| 380 | \\ stdout.print("before\n", .{}) catch unreachable; | 380 | \\ stdout.print("before\n", .{}) catch unreachable; |
| 381 | \\ defer stdout.print("defer1\n", .{}) catch unreachable; | 381 | \\ defer stdout.print("defer1\n", .{}) catch unreachable; |
| 382 | \\ defer stdout.print("defer2\n", .{}) catch unreachable; | 382 | \\ defer stdout.print("defer2\n", .{}) catch unreachable; |
| ... | @@ -393,7 +393,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void { | ... | @@ -393,7 +393,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void { |
| 393 | \\ do_test() catch return; | 393 | \\ do_test() catch return; |
| 394 | \\} | 394 | \\} |
| 395 | \\fn do_test() !void { | 395 | \\fn do_test() !void { |
| 396 | \\ const stdout = io.getStdOut().outStream(); | 396 | \\ const stdout = io.getStdOut().writer(); |
| 397 | \\ stdout.print("before\n", .{}) catch unreachable; | 397 | \\ stdout.print("before\n", .{}) catch unreachable; |
| 398 | \\ defer stdout.print("defer1\n", .{}) catch unreachable; | 398 | \\ defer stdout.print("defer1\n", .{}) catch unreachable; |
| 399 | \\ errdefer stdout.print("deferErr\n", .{}) catch unreachable; | 399 | \\ errdefer stdout.print("deferErr\n", .{}) catch unreachable; |
| ... | @@ -412,7 +412,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void { | ... | @@ -412,7 +412,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void { |
| 412 | \\ do_test() catch return; | 412 | \\ do_test() catch return; |
| 413 | \\} | 413 | \\} |
| 414 | \\fn do_test() !void { | 414 | \\fn do_test() !void { |
| 415 | \\ const stdout = io.getStdOut().outStream(); | 415 | \\ const stdout = io.getStdOut().writer(); |
| 416 | \\ stdout.print("before\n", .{}) catch unreachable; | 416 | \\ stdout.print("before\n", .{}) catch unreachable; |
| 417 | \\ defer stdout.print("defer1\n", .{}) catch unreachable; | 417 | \\ defer stdout.print("defer1\n", .{}) catch unreachable; |
| 418 | \\ errdefer stdout.print("deferErr\n", .{}) catch unreachable; | 418 | \\ errdefer stdout.print("deferErr\n", .{}) catch unreachable; |
| ... | @@ -429,7 +429,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void { | ... | @@ -429,7 +429,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void { |
| 429 | \\const io = @import("std").io; | 429 | \\const io = @import("std").io; |
| 430 | \\ | 430 | \\ |
| 431 | \\pub fn main() void { | 431 | \\pub fn main() void { |
| 432 | \\ const stdout = io.getStdOut().outStream(); | 432 | \\ const stdout = io.getStdOut().writer(); |
| 433 | \\ stdout.print(foo_txt, .{}) catch unreachable; | 433 | \\ stdout.print(foo_txt, .{}) catch unreachable; |
| 434 | \\} | 434 | \\} |
| 435 | , "1234\nabcd\n"); | 435 | , "1234\nabcd\n"); |
| ... | @@ -448,7 +448,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void { | ... | @@ -448,7 +448,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void { |
| 448 | \\ | 448 | \\ |
| 449 | \\pub fn main() !void { | 449 | \\pub fn main() !void { |
| 450 | \\ var args_it = std.process.args(); | 450 | \\ var args_it = std.process.args(); |
| 451 | \\ const stdout = io.getStdOut().outStream(); | 451 | \\ const stdout = io.getStdOut().writer(); |
| 452 | \\ var index: usize = 0; | 452 | \\ var index: usize = 0; |
| 453 | \\ _ = args_it.skip(); | 453 | \\ _ = args_it.skip(); |
| 454 | \\ while (args_it.next(allocator)) |arg_or_err| : (index += 1) { | 454 | \\ while (args_it.next(allocator)) |arg_or_err| : (index += 1) { |
| ... | @@ -487,7 +487,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void { | ... | @@ -487,7 +487,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void { |
| 487 | \\ | 487 | \\ |
| 488 | \\pub fn main() !void { | 488 | \\pub fn main() !void { |
| 489 | \\ var args_it = std.process.args(); | 489 | \\ var args_it = std.process.args(); |
| 490 | \\ const stdout = io.getStdOut().outStream(); | 490 | \\ const stdout = io.getStdOut().writer(); |
| 491 | \\ var index: usize = 0; | 491 | \\ var index: usize = 0; |
| 492 | \\ _ = args_it.skip(); | 492 | \\ _ = args_it.skip(); |
| 493 | \\ while (args_it.next(allocator)) |arg_or_err| : (index += 1) { | 493 | \\ while (args_it.next(allocator)) |arg_or_err| : (index += 1) { |
test/stage1/behavior/bugs/5487.zig+3-3| ... | @@ -3,10 +3,10 @@ const io = @import("std").io; | ... | @@ -3,10 +3,10 @@ const io = @import("std").io; |
| 3 | pub fn write(_: void, bytes: []const u8) !usize { | 3 | pub fn write(_: void, bytes: []const u8) !usize { |
| 4 | return 0; | 4 | return 0; |
| 5 | } | 5 | } |
| 6 | pub fn outStream() io.OutStream(void, @typeInfo(@typeInfo(@TypeOf(write)).Fn.return_type.?).ErrorUnion.error_set, write) { | 6 | pub fn writer() io.Writer(void, @typeInfo(@typeInfo(@TypeOf(write)).Fn.return_type.?).ErrorUnion.error_set, write) { |
| 7 | return io.OutStream(void, @typeInfo(@typeInfo(@TypeOf(write)).Fn.return_type.?).ErrorUnion.error_set, write){ .context = {} }; | 7 | return io.Writer(void, @typeInfo(@typeInfo(@TypeOf(write)).Fn.return_type.?).ErrorUnion.error_set, write){ .context = {} }; |
| 8 | } | 8 | } |
| 9 | 9 | ||
| 10 | test "crash" { | 10 | test "crash" { |
| 11 | _ = io.multiOutStream(.{outStream()}); | 11 | _ = io.multiWriter(.{writer()}); |
| 12 | } | 12 | } |
test/tests.zig+4-4| ... | @@ -652,9 +652,9 @@ pub const StackTracesContext = struct { | ... | @@ -652,9 +652,9 @@ pub const StackTracesContext = struct { |
| 652 | } | 652 | } |
| 653 | child.spawn() catch |err| debug.panic("Unable to spawn {s}: {s}\n", .{ full_exe_path, @errorName(err) }); | 653 | child.spawn() catch |err| debug.panic("Unable to spawn {s}: {s}\n", .{ full_exe_path, @errorName(err) }); |
| 654 | 654 | ||
| 655 | const stdout = child.stdout.?.inStream().readAllAlloc(b.allocator, max_stdout_size) catch unreachable; | 655 | const stdout = child.stdout.?.reader().readAllAlloc(b.allocator, max_stdout_size) catch unreachable; |
| 656 | defer b.allocator.free(stdout); | 656 | defer b.allocator.free(stdout); |
| 657 | const stderrFull = child.stderr.?.inStream().readAllAlloc(b.allocator, max_stdout_size) catch unreachable; | 657 | const stderrFull = child.stderr.?.reader().readAllAlloc(b.allocator, max_stdout_size) catch unreachable; |
| 658 | defer b.allocator.free(stderrFull); | 658 | defer b.allocator.free(stderrFull); |
| 659 | var stderr = stderrFull; | 659 | var stderr = stderrFull; |
| 660 | 660 | ||
| ... | @@ -875,8 +875,8 @@ pub const CompileErrorContext = struct { | ... | @@ -875,8 +875,8 @@ pub const CompileErrorContext = struct { |
| 875 | var stdout_buf = ArrayList(u8).init(b.allocator); | 875 | var stdout_buf = ArrayList(u8).init(b.allocator); |
| 876 | var stderr_buf = ArrayList(u8).init(b.allocator); | 876 | var stderr_buf = ArrayList(u8).init(b.allocator); |
| 877 | 877 | ||
| 878 | child.stdout.?.inStream().readAllArrayList(&stdout_buf, max_stdout_size) catch unreachable; | 878 | child.stdout.?.reader().readAllArrayList(&stdout_buf, max_stdout_size) catch unreachable; |
| 879 | child.stderr.?.inStream().readAllArrayList(&stderr_buf, max_stdout_size) catch unreachable; | 879 | child.stderr.?.reader().readAllArrayList(&stderr_buf, max_stdout_size) catch unreachable; |
| 880 | 880 | ||
| 881 | const term = child.wait() catch |err| { | 881 | const term = child.wait() catch |err| { |
| 882 | debug.panic("Unable to spawn {s}: {s}\n", .{ zig_args.items[0], @errorName(err) }); | 882 | debug.panic("Unable to spawn {s}: {s}\n", .{ zig_args.items[0], @errorName(err) }); |
tools/update_clang_options.zig+4-4| ... | @@ -388,8 +388,8 @@ pub fn main() anyerror!void { | ... | @@ -388,8 +388,8 @@ pub fn main() anyerror!void { |
| 388 | // "W" and "Wl,". So we sort this list in order of descending priority. | 388 | // "W" and "Wl,". So we sort this list in order of descending priority. |
| 389 | std.sort.sort(*json.ObjectMap, all_objects.items, {}, objectLessThan); | 389 | std.sort.sort(*json.ObjectMap, all_objects.items, {}, objectLessThan); |
| 390 | 390 | ||
| 391 | var stdout_bos = std.io.bufferedOutStream(std.io.getStdOut().outStream()); | 391 | var buffered_stdout = std.io.bufferedWriter(std.io.getStdOut().writer()); |
| 392 | const stdout = stdout_bos.outStream(); | 392 | const stdout = buffered_stdout.writer(); |
| 393 | try stdout.writeAll( | 393 | try stdout.writeAll( |
| 394 | \\// This file is generated by tools/update_clang_options.zig. | 394 | \\// This file is generated by tools/update_clang_options.zig. |
| 395 | \\// zig fmt: off | 395 | \\// zig fmt: off |
| ... | @@ -469,7 +469,7 @@ pub fn main() anyerror!void { | ... | @@ -469,7 +469,7 @@ pub fn main() anyerror!void { |
| 469 | \\ | 469 | \\ |
| 470 | ); | 470 | ); |
| 471 | 471 | ||
| 472 | try stdout_bos.flush(); | 472 | try buffered_stdout.flush(); |
| 473 | } | 473 | } |
| 474 | 474 | ||
| 475 | // TODO we should be able to import clang_options.zig but currently this is problematic because it will | 475 | // TODO we should be able to import clang_options.zig but currently this is problematic because it will |
| ... | @@ -611,7 +611,7 @@ fn objectLessThan(context: void, a: *json.ObjectMap, b: *json.ObjectMap) bool { | ... | @@ -611,7 +611,7 @@ fn objectLessThan(context: void, a: *json.ObjectMap, b: *json.ObjectMap) bool { |
| 611 | } | 611 | } |
| 612 | 612 | ||
| 613 | fn usageAndExit(file: fs.File, arg0: []const u8, code: u8) noreturn { | 613 | fn usageAndExit(file: fs.File, arg0: []const u8, code: u8) noreturn { |
| 614 | file.outStream().print( | 614 | file.writer().print( |
| 615 | \\Usage: {} /path/to/llvm-tblgen /path/to/git/llvm/llvm-project | 615 | \\Usage: {} /path/to/llvm-tblgen /path/to/git/llvm/llvm-project |
| 616 | \\Alternative Usage: zig run /path/to/git/zig/tools/update_clang_options.zig -- /path/to/llvm-tblgen /path/to/git/llvm/llvm-project | 616 | \\Alternative Usage: zig run /path/to/git/zig/tools/update_clang_options.zig -- /path/to/llvm-tblgen /path/to/git/llvm/llvm-project |
| 617 | \\ | 617 | \\ |
tools/update_glibc.zig+3-3| ... | @@ -239,7 +239,7 @@ pub fn main() !void { | ... | @@ -239,7 +239,7 @@ pub fn main() !void { |
| 239 | const vers_txt_path = try fs.path.join(allocator, &[_][]const u8{ glibc_out_dir, "vers.txt" }); | 239 | const vers_txt_path = try fs.path.join(allocator, &[_][]const u8{ glibc_out_dir, "vers.txt" }); |
| 240 | const vers_txt_file = try fs.cwd().createFile(vers_txt_path, .{}); | 240 | const vers_txt_file = try fs.cwd().createFile(vers_txt_path, .{}); |
| 241 | defer vers_txt_file.close(); | 241 | defer vers_txt_file.close(); |
| 242 | var buffered = std.io.bufferedOutStream(vers_txt_file.writer()); | 242 | var buffered = std.io.bufferedWriter(vers_txt_file.writer()); |
| 243 | const vers_txt = buffered.writer(); | 243 | const vers_txt = buffered.writer(); |
| 244 | for (global_ver_list) |name, i| { | 244 | for (global_ver_list) |name, i| { |
| 245 | _ = global_ver_set.put(name, i) catch unreachable; | 245 | _ = global_ver_set.put(name, i) catch unreachable; |
| ... | @@ -251,7 +251,7 @@ pub fn main() !void { | ... | @@ -251,7 +251,7 @@ pub fn main() !void { |
| 251 | const fns_txt_path = try fs.path.join(allocator, &[_][]const u8{ glibc_out_dir, "fns.txt" }); | 251 | const fns_txt_path = try fs.path.join(allocator, &[_][]const u8{ glibc_out_dir, "fns.txt" }); |
| 252 | const fns_txt_file = try fs.cwd().createFile(fns_txt_path, .{}); | 252 | const fns_txt_file = try fs.cwd().createFile(fns_txt_path, .{}); |
| 253 | defer fns_txt_file.close(); | 253 | defer fns_txt_file.close(); |
| 254 | var buffered = std.io.bufferedOutStream(fns_txt_file.writer()); | 254 | var buffered = std.io.bufferedWriter(fns_txt_file.writer()); |
| 255 | const fns_txt = buffered.writer(); | 255 | const fns_txt = buffered.writer(); |
| 256 | for (global_fn_list) |name, i| { | 256 | for (global_fn_list) |name, i| { |
| 257 | const entry = global_fn_set.getEntry(name).?; | 257 | const entry = global_fn_set.getEntry(name).?; |
| ... | @@ -282,7 +282,7 @@ pub fn main() !void { | ... | @@ -282,7 +282,7 @@ pub fn main() !void { |
| 282 | const abilist_txt_path = try fs.path.join(allocator, &[_][]const u8{ glibc_out_dir, "abi.txt" }); | 282 | const abilist_txt_path = try fs.path.join(allocator, &[_][]const u8{ glibc_out_dir, "abi.txt" }); |
| 283 | const abilist_txt_file = try fs.cwd().createFile(abilist_txt_path, .{}); | 283 | const abilist_txt_file = try fs.cwd().createFile(abilist_txt_path, .{}); |
| 284 | defer abilist_txt_file.close(); | 284 | defer abilist_txt_file.close(); |
| 285 | var buffered = std.io.bufferedOutStream(abilist_txt_file.writer()); | 285 | var buffered = std.io.bufferedWriter(abilist_txt_file.writer()); |
| 286 | const abilist_txt = buffered.writer(); | 286 | const abilist_txt = buffered.writer(); |
| 287 | 287 | ||
| 288 | // first iterate over the abi lists | 288 | // first iterate over the abi lists |