authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-12-08 18:07:55-08:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-12-23 22:15:08-08:00
loga91c6dc71d42ea59ec53ce4e0ae83e4970731313
tree815a549f1f16d6c6ce37d6f2d3034c484bb18ca9
parent1dcfc8787e86ed94d216976e621a49fc488e8214

test: std.fs.File -> std.Io.File


43 files changed, 106 insertions(+), 102 deletions(-)

test/cases/disable_stack_tracing.zig+1-1
...@@ -5,7 +5,7 @@ pub const std_options: std.Options = .{...@@ -5,7 +5,7 @@ pub const std_options: std.Options = .{
5pub fn main() !void {5pub fn main() !void {
6 var st_buf: [8]usize = undefined;6 var st_buf: [8]usize = undefined;
7 var buf: [1024]u8 = undefined;7 var buf: [1024]u8 = undefined;
8 var stdout = std.fs.File.stdout().writer(&buf);8 var stdout = std.Io.File.stdout().writer(&buf);
99
10 const captured_st = try foo(&stdout.interface, &st_buf);10 const captured_st = try foo(&stdout.interface, &st_buf);
11 try std.debug.writeStackTrace(&captured_st, &stdout.interface, .no_color);11 try std.debug.writeStackTrace(&captured_st, &stdout.interface, .no_color);
test/incremental/add_decl+6-6
...@@ -7,7 +7,7 @@...@@ -7,7 +7,7 @@
7#file=main.zig7#file=main.zig
8const std = @import("std");8const std = @import("std");
9pub fn main() !void {9pub fn main() !void {
10 try std.fs.File.stdout().writeAll(foo);10 try std.Io.File.stdout().writeAll(foo);
11}11}
12const foo = "good morning\n";12const foo = "good morning\n";
13#expect_stdout="good morning\n"13#expect_stdout="good morning\n"
...@@ -16,7 +16,7 @@ const foo = "good morning\n";...@@ -16,7 +16,7 @@ const foo = "good morning\n";
16#file=main.zig16#file=main.zig
17const std = @import("std");17const std = @import("std");
18pub fn main() !void {18pub fn main() !void {
19 try std.fs.File.stdout().writeAll(foo);19 try std.Io.File.stdout().writeAll(foo);
20}20}
21const foo = "good morning\n";21const foo = "good morning\n";
22const bar = "good evening\n";22const bar = "good evening\n";
...@@ -26,7 +26,7 @@ const bar = "good evening\n";...@@ -26,7 +26,7 @@ const bar = "good evening\n";
26#file=main.zig26#file=main.zig
27const std = @import("std");27const std = @import("std");
28pub fn main() !void {28pub fn main() !void {
29 try std.fs.File.stdout().writeAll(bar);29 try std.Io.File.stdout().writeAll(bar);
30}30}
31const foo = "good morning\n";31const foo = "good morning\n";
32const bar = "good evening\n";32const bar = "good evening\n";
...@@ -36,7 +36,7 @@ const bar = "good evening\n";...@@ -36,7 +36,7 @@ const bar = "good evening\n";
36#file=main.zig36#file=main.zig
37const std = @import("std");37const std = @import("std");
38pub fn main() !void {38pub fn main() !void {
39 try std.fs.File.stdout().writeAll(qux);39 try std.Io.File.stdout().writeAll(qux);
40}40}
41const foo = "good morning\n";41const foo = "good morning\n";
42const bar = "good evening\n";42const bar = "good evening\n";
...@@ -46,7 +46,7 @@ const bar = "good evening\n";...@@ -46,7 +46,7 @@ const bar = "good evening\n";
46#file=main.zig46#file=main.zig
47const std = @import("std");47const std = @import("std");
48pub fn main() !void {48pub fn main() !void {
49 try std.fs.File.stdout().writeAll(qux);49 try std.Io.File.stdout().writeAll(qux);
50}50}
51const foo = "good morning\n";51const foo = "good morning\n";
52const bar = "good evening\n";52const bar = "good evening\n";
...@@ -57,7 +57,7 @@ const qux = "good night\n";...@@ -57,7 +57,7 @@ const qux = "good night\n";
57#file=main.zig57#file=main.zig
58const std = @import("std");58const std = @import("std");
59pub fn main() !void {59pub fn main() !void {
60 try std.fs.File.stdout().writeAll(qux);60 try std.Io.File.stdout().writeAll(qux);
61}61}
62const qux = "good night\n";62const qux = "good night\n";
63#expect_stdout="good night\n"63#expect_stdout="good night\n"
test/incremental/add_decl_namespaced+6-6
...@@ -7,7 +7,7 @@...@@ -7,7 +7,7 @@
7#file=main.zig7#file=main.zig
8const std = @import("std");8const std = @import("std");
9pub fn main() !void {9pub fn main() !void {
10 try std.fs.File.stdout().writeAll(@This().foo);10 try std.Io.File.stdout().writeAll(@This().foo);
11}11}
12const foo = "good morning\n";12const foo = "good morning\n";
13#expect_stdout="good morning\n"13#expect_stdout="good morning\n"
...@@ -16,7 +16,7 @@ const foo = "good morning\n";...@@ -16,7 +16,7 @@ const foo = "good morning\n";
16#file=main.zig16#file=main.zig
17const std = @import("std");17const std = @import("std");
18pub fn main() !void {18pub fn main() !void {
19 try std.fs.File.stdout().writeAll(@This().foo);19 try std.Io.File.stdout().writeAll(@This().foo);
20}20}
21const foo = "good morning\n";21const foo = "good morning\n";
22const bar = "good evening\n";22const bar = "good evening\n";
...@@ -26,7 +26,7 @@ const bar = "good evening\n";...@@ -26,7 +26,7 @@ const bar = "good evening\n";
26#file=main.zig26#file=main.zig
27const std = @import("std");27const std = @import("std");
28pub fn main() !void {28pub fn main() !void {
29 try std.fs.File.stdout().writeAll(@This().bar);29 try std.Io.File.stdout().writeAll(@This().bar);
30}30}
31const foo = "good morning\n";31const foo = "good morning\n";
32const bar = "good evening\n";32const bar = "good evening\n";
...@@ -36,7 +36,7 @@ const bar = "good evening\n";...@@ -36,7 +36,7 @@ const bar = "good evening\n";
36#file=main.zig36#file=main.zig
37const std = @import("std");37const std = @import("std");
38pub fn main() !void {38pub fn main() !void {
39 try std.fs.File.stdout().writeAll(@This().qux);39 try std.Io.File.stdout().writeAll(@This().qux);
40}40}
41const foo = "good morning\n";41const foo = "good morning\n";
42const bar = "good evening\n";42const bar = "good evening\n";
...@@ -47,7 +47,7 @@ const bar = "good evening\n";...@@ -47,7 +47,7 @@ const bar = "good evening\n";
47#file=main.zig47#file=main.zig
48const std = @import("std");48const std = @import("std");
49pub fn main() !void {49pub fn main() !void {
50 try std.fs.File.stdout().writeAll(@This().qux);50 try std.Io.File.stdout().writeAll(@This().qux);
51}51}
52const foo = "good morning\n";52const foo = "good morning\n";
53const bar = "good evening\n";53const bar = "good evening\n";
...@@ -58,7 +58,7 @@ const qux = "good night\n";...@@ -58,7 +58,7 @@ const qux = "good night\n";
58#file=main.zig58#file=main.zig
59const std = @import("std");59const std = @import("std");
60pub fn main() !void {60pub fn main() !void {
61 try std.fs.File.stdout().writeAll(@This().qux);61 try std.Io.File.stdout().writeAll(@This().qux);
62}62}
63const qux = "good night\n";63const qux = "good night\n";
64#expect_stdout="good night\n"64#expect_stdout="good night\n"
test/incremental/bad_import+2-2
...@@ -8,7 +8,7 @@...@@ -8,7 +8,7 @@
8#file=main.zig8#file=main.zig
9pub fn main() !void {9pub fn main() !void {
10 _ = @import("foo.zig");10 _ = @import("foo.zig");
11 try std.fs.File.stdout().writeAll("success\n");11 try std.Io.File.stdout().writeAll("success\n");
12}12}
13const std = @import("std");13const std = @import("std");
14#file=foo.zig14#file=foo.zig
...@@ -30,7 +30,7 @@ comptime {...@@ -30,7 +30,7 @@ comptime {
30#file=main.zig30#file=main.zig
31pub fn main() !void {31pub fn main() !void {
32 //_ = @import("foo.zig");32 //_ = @import("foo.zig");
33 try std.fs.File.stdout().writeAll("success\n");33 try std.Io.File.stdout().writeAll("success\n");
34}34}
35const std = @import("std");35const std = @import("std");
36#expect_stdout="success\n"36#expect_stdout="success\n"
test/incremental/change_embed_file+3-3
...@@ -8,7 +8,7 @@...@@ -8,7 +8,7 @@
8const std = @import("std");8const std = @import("std");
9const string = @embedFile("string.txt");9const string = @embedFile("string.txt");
10pub fn main() !void {10pub fn main() !void {
11 try std.fs.File.stdout().writeAll(string);11 try std.Io.File.stdout().writeAll(string);
12}12}
13#file=string.txt13#file=string.txt
14Hello, World!14Hello, World!
...@@ -28,7 +28,7 @@ Hello again, World!...@@ -28,7 +28,7 @@ Hello again, World!
28const std = @import("std");28const std = @import("std");
29const string = @embedFile("string.txt");29const string = @embedFile("string.txt");
30pub fn main() !void {30pub fn main() !void {
31 try std.fs.File.stdout().writeAll("a hardcoded string\n");31 try std.Io.File.stdout().writeAll("a hardcoded string\n");
32}32}
33#expect_stdout="a hardcoded string\n"33#expect_stdout="a hardcoded string\n"
3434
...@@ -37,7 +37,7 @@ pub fn main() !void {...@@ -37,7 +37,7 @@ pub fn main() !void {
37const std = @import("std");37const std = @import("std");
38const string = @embedFile("string.txt");38const string = @embedFile("string.txt");
39pub fn main() !void {39pub fn main() !void {
40 try std.fs.File.stdout().writeAll(string);40 try std.Io.File.stdout().writeAll(string);
41}41}
42#expect_error=main.zig:2:27: error: unable to open 'string.txt': FileNotFound42#expect_error=main.zig:2:27: error: unable to open 'string.txt': FileNotFound
4343
test/incremental/change_enum_tag_type+3-3
...@@ -15,7 +15,7 @@ const Foo = enum(Tag) {...@@ -15,7 +15,7 @@ const Foo = enum(Tag) {
15pub fn main() !void {15pub fn main() !void {
16 var val: Foo = undefined;16 var val: Foo = undefined;
17 val = .a;17 val = .a;
18 var stdout_writer = std.fs.File.stdout().writerStreaming(&.{});18 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
19 try stdout_writer.interface.print("{s}\n", .{@tagName(val)});19 try stdout_writer.interface.print("{s}\n", .{@tagName(val)});
20}20}
21const std = @import("std");21const std = @import("std");
...@@ -33,7 +33,7 @@ const Foo = enum(Tag) {...@@ -33,7 +33,7 @@ const Foo = enum(Tag) {
33pub fn main() !void {33pub fn main() !void {
34 var val: Foo = undefined;34 var val: Foo = undefined;
35 val = .a;35 val = .a;
36 var stdout_writer = std.fs.File.stdout().writerStreaming(&.{});36 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
37 try stdout_writer.interface.print("{s}\n", .{@tagName(val)});37 try stdout_writer.interface.print("{s}\n", .{@tagName(val)});
38}38}
39comptime {39comptime {
...@@ -56,7 +56,7 @@ const Foo = enum(Tag) {...@@ -56,7 +56,7 @@ const Foo = enum(Tag) {
56pub fn main() !void {56pub fn main() !void {
57 var val: Foo = undefined;57 var val: Foo = undefined;
58 val = .a;58 val = .a;
59 var stdout_writer = std.fs.File.stdout().writerStreaming(&.{});59 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
60 try stdout_writer.interface.print("{s}\n", .{@tagName(val)});60 try stdout_writer.interface.print("{s}\n", .{@tagName(val)});
61}61}
62const std = @import("std");62const std = @import("std");
test/incremental/change_exports+6-6
...@@ -17,7 +17,7 @@ pub fn main() !void {...@@ -17,7 +17,7 @@ pub fn main() !void {
17 extern const bar: u32;17 extern const bar: u32;
18 };18 };
19 S.foo();19 S.foo();
20 var stdout_writer = std.fs.File.stdout().writerStreaming(&.{});20 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
21 try stdout_writer.interface.print("{}\n", .{S.bar});21 try stdout_writer.interface.print("{}\n", .{S.bar});
22}22}
23const std = @import("std");23const std = @import("std");
...@@ -39,7 +39,7 @@ pub fn main() !void {...@@ -39,7 +39,7 @@ pub fn main() !void {
39 extern const other: u32;39 extern const other: u32;
40 };40 };
41 S.foo();41 S.foo();
42 var stdout_writer = std.fs.File.stdout().writerStreaming(&.{});42 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
43 try stdout_writer.interface.print("{} {}\n", .{ S.bar, S.other });43 try stdout_writer.interface.print("{} {}\n", .{ S.bar, S.other });
44}44}
45const std = @import("std");45const std = @import("std");
...@@ -62,7 +62,7 @@ pub fn main() !void {...@@ -62,7 +62,7 @@ pub fn main() !void {
62 extern const other: u32;62 extern const other: u32;
63 };63 };
64 S.foo();64 S.foo();
65 var stdout_writer = std.fs.File.stdout().writerStreaming(&.{});65 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
66 try stdout_writer.interface.print("{} {}\n", .{ S.bar, S.other });66 try stdout_writer.interface.print("{} {}\n", .{ S.bar, S.other });
67}67}
68const std = @import("std");68const std = @import("std");
...@@ -87,7 +87,7 @@ pub fn main() !void {...@@ -87,7 +87,7 @@ pub fn main() !void {
87 extern const other: u32;87 extern const other: u32;
88 };88 };
89 S.foo();89 S.foo();
90 var stdout_writer = std.fs.File.stdout().writerStreaming(&.{});90 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
91 try stdout_writer.interface.print("{} {}\n", .{ S.bar, S.other });91 try stdout_writer.interface.print("{} {}\n", .{ S.bar, S.other });
92}92}
93const std = @import("std");93const std = @import("std");
...@@ -133,7 +133,7 @@ pub fn main() !void {...@@ -133,7 +133,7 @@ pub fn main() !void {
133 extern const other: u32;133 extern const other: u32;
134 };134 };
135 S.foo();135 S.foo();
136 var stdout_writer = std.fs.File.stdout().writerStreaming(&.{});136 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
137 try stdout_writer.interface.print("{} {}\n", .{ S.bar, S.other });137 try stdout_writer.interface.print("{} {}\n", .{ S.bar, S.other });
138}138}
139const std = @import("std");139const std = @import("std");
...@@ -158,7 +158,7 @@ pub fn main() !void {...@@ -158,7 +158,7 @@ pub fn main() !void {
158 extern const other: u32;158 extern const other: u32;
159 };159 };
160 S.foo();160 S.foo();
161 var stdout_writer = std.fs.File.stdout().writerStreaming(&.{});161 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
162 try stdout_writer.interface.print("{} {}\n", .{ S.bar, S.other });162 try stdout_writer.interface.print("{} {}\n", .{ S.bar, S.other });
163}163}
164const std = @import("std");164const std = @import("std");
test/incremental/change_fn_type+3-3
...@@ -8,7 +8,7 @@ pub fn main() !void {...@@ -8,7 +8,7 @@ pub fn main() !void {
8 try foo(123);8 try foo(123);
9}9}
10fn foo(x: u8) !void {10fn foo(x: u8) !void {
11 var stdout_writer = std.fs.File.stdout().writerStreaming(&.{});11 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
12 return stdout_writer.interface.print("{d}\n", .{x});12 return stdout_writer.interface.print("{d}\n", .{x});
13}13}
14const std = @import("std");14const std = @import("std");
...@@ -20,7 +20,7 @@ pub fn main() !void {...@@ -20,7 +20,7 @@ pub fn main() !void {
20 try foo(123);20 try foo(123);
21}21}
22fn foo(x: i64) !void {22fn foo(x: i64) !void {
23 var stdout_writer = std.fs.File.stdout().writerStreaming(&.{});23 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
24 return stdout_writer.interface.print("{d}\n", .{x});24 return stdout_writer.interface.print("{d}\n", .{x});
25}25}
26const std = @import("std");26const std = @import("std");
...@@ -32,7 +32,7 @@ pub fn main() !void {...@@ -32,7 +32,7 @@ pub fn main() !void {
32 try foo(-42);32 try foo(-42);
33}33}
34fn foo(x: i64) !void {34fn foo(x: i64) !void {
35 var stdout_writer = std.fs.File.stdout().writerStreaming(&.{});35 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
36 return stdout_writer.interface.print("{d}\n", .{x});36 return stdout_writer.interface.print("{d}\n", .{x});
37}37}
38const std = @import("std");38const std = @import("std");
test/incremental/change_generic_line_number+2-2
...@@ -7,7 +7,7 @@ const std = @import("std");...@@ -7,7 +7,7 @@ const std = @import("std");
7fn Printer(message: []const u8) type {7fn Printer(message: []const u8) type {
8 return struct {8 return struct {
9 fn print() !void {9 fn print() !void {
10 try std.fs.File.stdout().writeAll(message);10 try std.Io.File.stdout().writeAll(message);
11 }11 }
12 };12 };
13}13}
...@@ -23,7 +23,7 @@ const std = @import("std");...@@ -23,7 +23,7 @@ const std = @import("std");
23fn Printer(message: []const u8) type {23fn Printer(message: []const u8) type {
24 return struct {24 return struct {
25 fn print() !void {25 fn print() !void {
26 try std.fs.File.stdout().writeAll(message);26 try std.Io.File.stdout().writeAll(message);
27 }27 }
28 };28 };
29}29}
test/incremental/change_line_number+2-2
...@@ -5,7 +5,7 @@...@@ -5,7 +5,7 @@
5#file=main.zig5#file=main.zig
6const std = @import("std");6const std = @import("std");
7pub fn main() !void {7pub fn main() !void {
8 try std.fs.File.stdout().writeAll("foo\n");8 try std.Io.File.stdout().writeAll("foo\n");
9}9}
10#expect_stdout="foo\n"10#expect_stdout="foo\n"
11#update=change line number11#update=change line number
...@@ -13,6 +13,6 @@ pub fn main() !void {...@@ -13,6 +13,6 @@ pub fn main() !void {
13const std = @import("std");13const std = @import("std");
1414
15pub fn main() !void {15pub fn main() !void {
16 try std.fs.File.stdout().writeAll("foo\n");16 try std.Io.File.stdout().writeAll("foo\n");
17}17}
18#expect_stdout="foo\n"18#expect_stdout="foo\n"
test/incremental/change_panic_handler+3-3
...@@ -12,7 +12,7 @@ pub fn main() !u8 {...@@ -12,7 +12,7 @@ pub fn main() !u8 {
12}12}
13pub const panic = std.debug.FullPanic(myPanic);13pub const panic = std.debug.FullPanic(myPanic);
14fn myPanic(msg: []const u8, _: ?usize) noreturn {14fn myPanic(msg: []const u8, _: ?usize) noreturn {
15 var stdout_writer = std.fs.File.stdout().writerStreaming(&.{});15 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
16 stdout_writer.interface.print("panic message: {s}\n", .{msg}) catch {};16 stdout_writer.interface.print("panic message: {s}\n", .{msg}) catch {};
17 std.process.exit(0);17 std.process.exit(0);
18}18}
...@@ -29,7 +29,7 @@ pub fn main() !u8 {...@@ -29,7 +29,7 @@ pub fn main() !u8 {
29}29}
30pub const panic = std.debug.FullPanic(myPanic);30pub const panic = std.debug.FullPanic(myPanic);
31fn myPanic(msg: []const u8, _: ?usize) noreturn {31fn myPanic(msg: []const u8, _: ?usize) noreturn {
32 var stdout_writer = std.fs.File.stdout().writerStreaming(&.{});32 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
33 stdout_writer.interface.print("new panic message: {s}\n", .{msg}) catch {};33 stdout_writer.interface.print("new panic message: {s}\n", .{msg}) catch {};
34 std.process.exit(0);34 std.process.exit(0);
35}35}
...@@ -46,7 +46,7 @@ pub fn main() !u8 {...@@ -46,7 +46,7 @@ pub fn main() !u8 {
46}46}
47pub const panic = std.debug.FullPanic(myPanicNew);47pub const panic = std.debug.FullPanic(myPanicNew);
48fn myPanicNew(msg: []const u8, _: ?usize) noreturn {48fn myPanicNew(msg: []const u8, _: ?usize) noreturn {
49 var stdout_writer = std.fs.File.stdout().writerStreaming(&.{});49 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
50 stdout_writer.interface.print("third panic message: {s}\n", .{msg}) catch {};50 stdout_writer.interface.print("third panic message: {s}\n", .{msg}) catch {};
51 std.process.exit(0);51 std.process.exit(0);
52}52}
test/incremental/change_panic_handler_explicit+3-3
...@@ -42,7 +42,7 @@ pub const panic = struct {...@@ -42,7 +42,7 @@ pub const panic = struct {
42 pub const noreturnReturned = no_panic.noreturnReturned;42 pub const noreturnReturned = no_panic.noreturnReturned;
43};43};
44fn myPanic(msg: []const u8, _: ?usize) noreturn {44fn myPanic(msg: []const u8, _: ?usize) noreturn {
45 var stdout_writer = std.fs.File.stdout().writerStreaming(&.{});45 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
46 stdout_writer.interface.print("panic message: {s}\n", .{msg}) catch {};46 stdout_writer.interface.print("panic message: {s}\n", .{msg}) catch {};
47 std.process.exit(0);47 std.process.exit(0);
48}48}
...@@ -89,7 +89,7 @@ pub const panic = struct {...@@ -89,7 +89,7 @@ pub const panic = struct {
89 pub const noreturnReturned = no_panic.noreturnReturned;89 pub const noreturnReturned = no_panic.noreturnReturned;
90};90};
91fn myPanic(msg: []const u8, _: ?usize) noreturn {91fn myPanic(msg: []const u8, _: ?usize) noreturn {
92 var stdout_writer = std.fs.File.stdout().writerStreaming(&.{});92 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
93 stdout_writer.interface.print("new panic message: {s}\n", .{msg}) catch {};93 stdout_writer.interface.print("new panic message: {s}\n", .{msg}) catch {};
94 std.process.exit(0);94 std.process.exit(0);
95}95}
...@@ -136,7 +136,7 @@ pub const panic = struct {...@@ -136,7 +136,7 @@ pub const panic = struct {
136 pub const noreturnReturned = no_panic.noreturnReturned;136 pub const noreturnReturned = no_panic.noreturnReturned;
137};137};
138fn myPanicNew(msg: []const u8, _: ?usize) noreturn {138fn myPanicNew(msg: []const u8, _: ?usize) noreturn {
139 var stdout_writer = std.fs.File.stdout().writerStreaming(&.{});139 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
140 stdout_writer.interface.print("third panic message: {s}\n", .{msg}) catch {};140 stdout_writer.interface.print("third panic message: {s}\n", .{msg}) catch {};
141 std.process.exit(0);141 std.process.exit(0);
142}142}
test/incremental/change_shift_op+2-2
...@@ -9,7 +9,7 @@ pub fn main() !void {...@@ -9,7 +9,7 @@ pub fn main() !void {
9 try foo(0x1300);9 try foo(0x1300);
10}10}
11fn foo(x: u16) !void {11fn foo(x: u16) !void {
12 var stdout_writer = std.fs.File.stdout().writerStreaming(&.{});12 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
13 try stdout_writer.interface.print("0x{x}\n", .{x << 4});13 try stdout_writer.interface.print("0x{x}\n", .{x << 4});
14}14}
15const std = @import("std");15const std = @import("std");
...@@ -20,7 +20,7 @@ pub fn main() !void {...@@ -20,7 +20,7 @@ pub fn main() !void {
20 try foo(0x1300);20 try foo(0x1300);
21}21}
22fn foo(x: u16) !void {22fn foo(x: u16) !void {
23 var stdout_writer = std.fs.File.stdout().writerStreaming(&.{});23 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
24 try stdout_writer.interface.print("0x{x}\n", .{x >> 4});24 try stdout_writer.interface.print("0x{x}\n", .{x >> 4});
25}25}
26const std = @import("std");26const std = @import("std");
test/incremental/change_struct_same_fields+3-3
...@@ -11,7 +11,7 @@ pub fn main() !void {...@@ -11,7 +11,7 @@ pub fn main() !void {
11 try foo(&val);11 try foo(&val);
12}12}
13fn foo(val: *const S) !void {13fn foo(val: *const S) !void {
14 var stdout_writer = std.fs.File.stdout().writerStreaming(&.{});14 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
15 try stdout_writer.interface.print(15 try stdout_writer.interface.print(
16 "{d} {d}\n",16 "{d} {d}\n",
17 .{ val.x, val.y },17 .{ val.x, val.y },
...@@ -28,7 +28,7 @@ pub fn main() !void {...@@ -28,7 +28,7 @@ pub fn main() !void {
28 try foo(&val);28 try foo(&val);
29}29}
30fn foo(val: *const S) !void {30fn foo(val: *const S) !void {
31 var stdout_writer = std.fs.File.stdout().writerStreaming(&.{});31 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
32 try stdout_writer.interface.print(32 try stdout_writer.interface.print(
33 "{d} {d}\n",33 "{d} {d}\n",
34 .{ val.x, val.y },34 .{ val.x, val.y },
...@@ -45,7 +45,7 @@ pub fn main() !void {...@@ -45,7 +45,7 @@ pub fn main() !void {
45 try foo(&val);45 try foo(&val);
46}46}
47fn foo(val: *const S) !void {47fn foo(val: *const S) !void {
48 var stdout_writer = std.fs.File.stdout().writerStreaming(&.{});48 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
49 try stdout_writer.interface.print(49 try stdout_writer.interface.print(
50 "{d} {d}\n",50 "{d} {d}\n",
51 .{ val.x, val.y },51 .{ val.x, val.y },
test/incremental/change_zon_file+3-3
...@@ -8,7 +8,7 @@...@@ -8,7 +8,7 @@
8const std = @import("std");8const std = @import("std");
9const message: []const u8 = @import("message.zon");9const message: []const u8 = @import("message.zon");
10pub fn main() !void {10pub fn main() !void {
11 try std.fs.File.stdout().writeAll(message);11 try std.Io.File.stdout().writeAll(message);
12}12}
13#file=message.zon13#file=message.zon
14"Hello, World!\n"14"Hello, World!\n"
...@@ -29,7 +29,7 @@ pub fn main() !void {...@@ -29,7 +29,7 @@ pub fn main() !void {
29const std = @import("std");29const std = @import("std");
30const message: []const u8 = @import("message.zon");30const message: []const u8 = @import("message.zon");
31pub fn main() !void {31pub fn main() !void {
32 try std.fs.File.stdout().writeAll("a hardcoded string\n");32 try std.Io.File.stdout().writeAll("a hardcoded string\n");
33}33}
34#expect_error=message.zon:1:1: error: unable to load 'message.zon': FileNotFound34#expect_error=message.zon:1:1: error: unable to load 'message.zon': FileNotFound
35#expect_error=main.zig:2:37: note: file imported here35#expect_error=main.zig:2:37: note: file imported here
...@@ -44,6 +44,6 @@ pub fn main() !void {...@@ -44,6 +44,6 @@ pub fn main() !void {
44const std = @import("std");44const std = @import("std");
45const message: []const u8 = @import("message.zon");45const message: []const u8 = @import("message.zon");
46pub fn main() !void {46pub fn main() !void {
47 try std.fs.File.stdout().writeAll(message);47 try std.Io.File.stdout().writeAll(message);
48}48}
49#expect_stdout="We're back, World!\n"49#expect_stdout="We're back, World!\n"
test/incremental/change_zon_file_no_result_type+1-1
...@@ -7,7 +7,7 @@...@@ -7,7 +7,7 @@
7#file=main.zig7#file=main.zig
8const std = @import("std");8const std = @import("std");
9pub fn main() !void {9pub fn main() !void {
10 try std.fs.File.stdout().writeAll(@import("foo.zon").message);10 try std.Io.File.stdout().writeAll(@import("foo.zon").message);
11}11}
12#file=foo.zon12#file=foo.zon
13.{13.{
test/incremental/compile_log+3-3
...@@ -8,7 +8,7 @@...@@ -8,7 +8,7 @@
8#file=main.zig8#file=main.zig
9const std = @import("std");9const std = @import("std");
10pub fn main() !void {10pub fn main() !void {
11 try std.fs.File.stdout().writeAll("Hello, World!\n");11 try std.Io.File.stdout().writeAll("Hello, World!\n");
12}12}
13#expect_stdout="Hello, World!\n"13#expect_stdout="Hello, World!\n"
1414
...@@ -16,7 +16,7 @@ pub fn main() !void {...@@ -16,7 +16,7 @@ pub fn main() !void {
16#file=main.zig16#file=main.zig
17const std = @import("std");17const std = @import("std");
18pub fn main() !void {18pub fn main() !void {
19 try std.fs.File.stdout().writeAll("Hello, World!\n");19 try std.Io.File.stdout().writeAll("Hello, World!\n");
20 @compileLog("this is a log");20 @compileLog("this is a log");
21}21}
22#expect_error=main.zig:4:5: error: found compile log statement22#expect_error=main.zig:4:5: error: found compile log statement
...@@ -26,6 +26,6 @@ pub fn main() !void {...@@ -26,6 +26,6 @@ pub fn main() !void {
26#file=main.zig26#file=main.zig
27const std = @import("std");27const std = @import("std");
28pub fn main() !void {28pub fn main() !void {
29 try std.fs.File.stdout().writeAll("Hello, World!\n");29 try std.Io.File.stdout().writeAll("Hello, World!\n");
30}30}
31#expect_stdout="Hello, World!\n"31#expect_stdout="Hello, World!\n"
test/incremental/fix_astgen_failure+4-4
...@@ -10,21 +10,21 @@ pub fn main() !void {...@@ -10,21 +10,21 @@ pub fn main() !void {
10}10}
11#file=foo.zig11#file=foo.zig
12pub fn hello() !void {12pub fn hello() !void {
13 try std.fs.File.stdout().writeAll("Hello, World!\n");13 try std.Io.File.stdout().writeAll("Hello, World!\n");
14}14}
15#expect_error=foo.zig:2:9: error: use of undeclared identifier 'std'15#expect_error=foo.zig:2:9: error: use of undeclared identifier 'std'
16#update=fix the error16#update=fix the error
17#file=foo.zig17#file=foo.zig
18const std = @import("std");18const std = @import("std");
19pub fn hello() !void {19pub fn hello() !void {
20 try std.fs.File.stdout().writeAll("Hello, World!\n");20 try std.Io.File.stdout().writeAll("Hello, World!\n");
21}21}
22#expect_stdout="Hello, World!\n"22#expect_stdout="Hello, World!\n"
23#update=add new error23#update=add new error
24#file=foo.zig24#file=foo.zig
25const std = @import("std");25const std = @import("std");
26pub fn hello() !void {26pub fn hello() !void {
27 try std.fs.File.stdout().writeAll(hello_str);27 try std.Io.File.stdout().writeAll(hello_str);
28}28}
29#expect_error=foo.zig:3:39: error: use of undeclared identifier 'hello_str'29#expect_error=foo.zig:3:39: error: use of undeclared identifier 'hello_str'
30#update=fix the new error30#update=fix the new error
...@@ -32,6 +32,6 @@ pub fn hello() !void {...@@ -32,6 +32,6 @@ pub fn hello() !void {
32const std = @import("std");32const std = @import("std");
33const hello_str = "Hello, World! Again!\n";33const hello_str = "Hello, World! Again!\n";
34pub fn hello() !void {34pub fn hello() !void {
35 try std.fs.File.stdout().writeAll(hello_str);35 try std.Io.File.stdout().writeAll(hello_str);
36}36}
37#expect_stdout="Hello, World! Again!\n"37#expect_stdout="Hello, World! Again!\n"
test/incremental/function_becomes_inline+3-3
...@@ -8,7 +8,7 @@ pub fn main() !void {...@@ -8,7 +8,7 @@ pub fn main() !void {
8 try foo();8 try foo();
9}9}
10fn foo() !void {10fn foo() !void {
11 try std.fs.File.stdout().writeAll("Hello, World!\n");11 try std.Io.File.stdout().writeAll("Hello, World!\n");
12}12}
13const std = @import("std");13const std = @import("std");
14#expect_stdout="Hello, World!\n"14#expect_stdout="Hello, World!\n"
...@@ -19,7 +19,7 @@ pub fn main() !void {...@@ -19,7 +19,7 @@ pub fn main() !void {
19 try foo();19 try foo();
20}20}
21inline fn foo() !void {21inline fn foo() !void {
22 try std.fs.File.stdout().writeAll("Hello, World!\n");22 try std.Io.File.stdout().writeAll("Hello, World!\n");
23}23}
24const std = @import("std");24const std = @import("std");
25#expect_stdout="Hello, World!\n"25#expect_stdout="Hello, World!\n"
...@@ -30,7 +30,7 @@ pub fn main() !void {...@@ -30,7 +30,7 @@ pub fn main() !void {
30 try foo();30 try foo();
31}31}
32inline fn foo() !void {32inline fn foo() !void {
33 try std.fs.File.stdout().writeAll("Hello, `inline` World!\n");33 try std.Io.File.stdout().writeAll("Hello, `inline` World!\n");
34}34}
35const std = @import("std");35const std = @import("std");
36#expect_stdout="Hello, `inline` World!\n"36#expect_stdout="Hello, `inline` World!\n"
test/incremental/hello+2-2
...@@ -7,13 +7,13 @@...@@ -7,13 +7,13 @@
7#file=main.zig7#file=main.zig
8const std = @import("std");8const std = @import("std");
9pub fn main() !void {9pub fn main() !void {
10 try std.fs.File.stdout().writeAll("good morning\n");10 try std.Io.File.stdout().writeAll("good morning\n");
11}11}
12#expect_stdout="good morning\n"12#expect_stdout="good morning\n"
13#update=change the string13#update=change the string
14#file=main.zig14#file=main.zig
15const std = @import("std");15const std = @import("std");
16pub fn main() !void {16pub fn main() !void {
17 try std.fs.File.stdout().writeAll("おはようございます\n");17 try std.Io.File.stdout().writeAll("おはようございます\n");
18}18}
19#expect_stdout="おはようございます\n"19#expect_stdout="おはようございます\n"
test/incremental/make_decl_pub+2-2
...@@ -12,7 +12,7 @@ pub fn main() !void {...@@ -12,7 +12,7 @@ pub fn main() !void {
12#file=foo.zig12#file=foo.zig
13const std = @import("std");13const std = @import("std");
14fn hello() !void {14fn hello() !void {
15 try std.fs.File.stdout().writeAll("Hello, World!\n");15 try std.Io.File.stdout().writeAll("Hello, World!\n");
16}16}
17#expect_error=main.zig:3:12: error: 'hello' is not marked 'pub'17#expect_error=main.zig:3:12: error: 'hello' is not marked 'pub'
18#expect_error=foo.zig:2:1: note: declared here18#expect_error=foo.zig:2:1: note: declared here
...@@ -21,6 +21,6 @@ fn hello() !void {...@@ -21,6 +21,6 @@ fn hello() !void {
21#file=foo.zig21#file=foo.zig
22const std = @import("std");22const std = @import("std");
23pub fn hello() !void {23pub fn hello() !void {
24 try std.fs.File.stdout().writeAll("Hello, World!\n");24 try std.Io.File.stdout().writeAll("Hello, World!\n");
25}25}
26#expect_stdout="Hello, World!\n"26#expect_stdout="Hello, World!\n"
test/incremental/modify_inline_fn+2-2
...@@ -8,7 +8,7 @@...@@ -8,7 +8,7 @@
8const std = @import("std");8const std = @import("std");
9pub fn main() !void {9pub fn main() !void {
10 const str = getStr();10 const str = getStr();
11 try std.fs.File.stdout().writeAll(str);11 try std.Io.File.stdout().writeAll(str);
12}12}
13inline fn getStr() []const u8 {13inline fn getStr() []const u8 {
14 return "foo\n";14 return "foo\n";
...@@ -19,7 +19,7 @@ inline fn getStr() []const u8 {...@@ -19,7 +19,7 @@ inline fn getStr() []const u8 {
19const std = @import("std");19const std = @import("std");
20pub fn main() !void {20pub fn main() !void {
21 const str = getStr();21 const str = getStr();
22 try std.fs.File.stdout().writeAll(str);22 try std.Io.File.stdout().writeAll(str);
23}23}
24inline fn getStr() []const u8 {24inline fn getStr() []const u8 {
25 return "bar\n";25 return "bar\n";
test/incremental/move_src+2-2
...@@ -7,7 +7,7 @@...@@ -7,7 +7,7 @@
7#file=main.zig7#file=main.zig
8const std = @import("std");8const std = @import("std");
9pub fn main() !void {9pub fn main() !void {
10 var stdout_writer = std.fs.File.stdout().writerStreaming(&.{});10 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
11 try stdout_writer.interface.print("{d} {d}\n", .{ foo(), bar() });11 try stdout_writer.interface.print("{d} {d}\n", .{ foo(), bar() });
12}12}
13fn foo() u32 {13fn foo() u32 {
...@@ -22,7 +22,7 @@ fn bar() u32 {...@@ -22,7 +22,7 @@ fn bar() u32 {
22#file=main.zig22#file=main.zig
23const std = @import("std");23const std = @import("std");
24pub fn main() !void {24pub fn main() !void {
25 var stdout_writer = std.fs.File.stdout().writerStreaming(&.{});25 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
26 try stdout_writer.interface.print("{d} {d}\n", .{ foo(), bar() });26 try stdout_writer.interface.print("{d} {d}\n", .{ foo(), bar() });
27}27}
2828
test/incremental/no_change_preserves_tag_names+2-2
...@@ -8,7 +8,7 @@...@@ -8,7 +8,7 @@
8const std = @import("std");8const std = @import("std");
9var some_enum: enum { first, second } = .first;9var some_enum: enum { first, second } = .first;
10pub fn main() !void {10pub fn main() !void {
11 try std.fs.File.stdout().writeAll(@tagName(some_enum));11 try std.Io.File.stdout().writeAll(@tagName(some_enum));
12}12}
13#expect_stdout="first"13#expect_stdout="first"
14#update=no change14#update=no change
...@@ -16,6 +16,6 @@ pub fn main() !void {...@@ -16,6 +16,6 @@ pub fn main() !void {
16const std = @import("std");16const std = @import("std");
17var some_enum: enum { first, second } = .first;17var some_enum: enum { first, second } = .first;
18pub fn main() !void {18pub fn main() !void {
19 try std.fs.File.stdout().writeAll(@tagName(some_enum));19 try std.Io.File.stdout().writeAll(@tagName(some_enum));
20}20}
21#expect_stdout="first"21#expect_stdout="first"
test/incremental/recursive_function_becomes_non_recursive+2-2
...@@ -9,7 +9,7 @@ pub fn main() !void {...@@ -9,7 +9,7 @@ pub fn main() !void {
9 try foo(false);9 try foo(false);
10}10}
11fn foo(recurse: bool) !void {11fn foo(recurse: bool) !void {
12 const stdout = std.fs.File.stdout();12 const stdout = std.Io.File.stdout();
13 if (recurse) return foo(true);13 if (recurse) return foo(true);
14 try stdout.writeAll("non-recursive path\n");14 try stdout.writeAll("non-recursive path\n");
15}15}
...@@ -22,7 +22,7 @@ pub fn main() !void {...@@ -22,7 +22,7 @@ pub fn main() !void {
22 try foo(true);22 try foo(true);
23}23}
24fn foo(recurse: bool) !void {24fn foo(recurse: bool) !void {
25 const stdout = std.fs.File.stdout();25 const stdout = std.Io.File.stdout();
26 if (recurse) return stdout.writeAll("x==1\n");26 if (recurse) return stdout.writeAll("x==1\n");
27 try stdout.writeAll("non-recursive path\n");27 try stdout.writeAll("non-recursive path\n");
28}28}
test/incremental/remove_enum_field+2-2
...@@ -10,7 +10,7 @@ const MyEnum = enum(u8) {...@@ -10,7 +10,7 @@ const MyEnum = enum(u8) {
10 bar = 2,10 bar = 2,
11};11};
12pub fn main() !void {12pub fn main() !void {
13 var stdout_writer = std.fs.File.stdout().writerStreaming(&.{});13 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
14 try stdout_writer.interface.print("{}\n", .{@intFromEnum(MyEnum.foo)});14 try stdout_writer.interface.print("{}\n", .{@intFromEnum(MyEnum.foo)});
15}15}
16const std = @import("std");16const std = @import("std");
...@@ -22,7 +22,7 @@ const MyEnum = enum(u8) {...@@ -22,7 +22,7 @@ const MyEnum = enum(u8) {
22 bar = 2,22 bar = 2,
23};23};
24pub fn main() !void {24pub fn main() !void {
25 var stdout_writer = std.fs.File.stdout().writerStreaming(&.{});25 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
26 try stdout_writer.interface.print("{}\n", .{@intFromEnum(MyEnum.foo)});26 try stdout_writer.interface.print("{}\n", .{@intFromEnum(MyEnum.foo)});
27}27}
28const std = @import("std");28const std = @import("std");
test/incremental/unreferenced_error+4-4
...@@ -7,7 +7,7 @@...@@ -7,7 +7,7 @@
7#file=main.zig7#file=main.zig
8const std = @import("std");8const std = @import("std");
9pub fn main() !void {9pub fn main() !void {
10 try std.fs.File.stdout().writeAll(a);10 try std.Io.File.stdout().writeAll(a);
11}11}
12const a = "Hello, World!\n";12const a = "Hello, World!\n";
13#expect_stdout="Hello, World!\n"13#expect_stdout="Hello, World!\n"
...@@ -16,7 +16,7 @@ const a = "Hello, World!\n";...@@ -16,7 +16,7 @@ const a = "Hello, World!\n";
16#file=main.zig16#file=main.zig
17const std = @import("std");17const std = @import("std");
18pub fn main() !void {18pub fn main() !void {
19 try std.fs.File.stdout().writeAll(a);19 try std.Io.File.stdout().writeAll(a);
20}20}
21const a = @compileError("bad a");21const a = @compileError("bad a");
22#expect_error=main.zig:5:11: error: bad a22#expect_error=main.zig:5:11: error: bad a
...@@ -25,7 +25,7 @@ const a = @compileError("bad a");...@@ -25,7 +25,7 @@ const a = @compileError("bad a");
25#file=main.zig25#file=main.zig
26const std = @import("std");26const std = @import("std");
27pub fn main() !void {27pub fn main() !void {
28 try std.fs.File.stdout().writeAll(b);28 try std.Io.File.stdout().writeAll(b);
29}29}
30const a = @compileError("bad a");30const a = @compileError("bad a");
31const b = "Hi there!\n";31const b = "Hi there!\n";
...@@ -35,7 +35,7 @@ const b = "Hi there!\n";...@@ -35,7 +35,7 @@ const b = "Hi there!\n";
35#file=main.zig35#file=main.zig
36const std = @import("std");36const std = @import("std");
37pub fn main() !void {37pub fn main() !void {
38 try std.fs.File.stdout().writeAll(a);38 try std.Io.File.stdout().writeAll(a);
39}39}
40const a = "Back to a\n";40const a = "Back to a\n";
41const b = @compileError("bad b");41const b = @compileError("bad b");
test/link/bss/main.zig+1-1
...@@ -4,7 +4,7 @@ const std = @import("std");...@@ -4,7 +4,7 @@ const std = @import("std");
4var buffer: [0x1000000]u64 = [1]u64{0} ** 0x1000000;4var buffer: [0x1000000]u64 = [1]u64{0} ** 0x1000000;
55
6pub fn main() anyerror!void {6pub fn main() anyerror!void {
7 var stdout_writer = std.fs.File.stdout().writerStreaming(&.{});7 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
88
9 buffer[0x10] = 1;9 buffer[0x10] = 1;
1010
test/link/elf.zig+2-2
...@@ -1323,7 +1323,7 @@ fn testGcSectionsZig(b: *Build, opts: Options) *Step {...@@ -1323,7 +1323,7 @@ fn testGcSectionsZig(b: *Build, opts: Options) *Step {
1323 \\extern var live_var2: i32;1323 \\extern var live_var2: i32;
1324 \\extern fn live_fn2() void;1324 \\extern fn live_fn2() void;
1325 \\pub fn main() void {1325 \\pub fn main() void {
1326 \\ var stdout_writer = std.fs.File.stdout().writerStreaming(&.{});1326 \\ var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
1327 \\ stdout_writer.interface.print("{d} {d}\n", .{ live_var1, live_var2 }) catch @panic("fail");1327 \\ stdout_writer.interface.print("{d} {d}\n", .{ live_var1, live_var2 }) catch @panic("fail");
1328 \\ live_fn2();1328 \\ live_fn2();
1329 \\}1329 \\}
...@@ -1365,7 +1365,7 @@ fn testGcSectionsZig(b: *Build, opts: Options) *Step {...@@ -1365,7 +1365,7 @@ fn testGcSectionsZig(b: *Build, opts: Options) *Step {
1365 \\extern var live_var2: i32;1365 \\extern var live_var2: i32;
1366 \\extern fn live_fn2() void;1366 \\extern fn live_fn2() void;
1367 \\pub fn main() void {1367 \\pub fn main() void {
1368 \\ var stdout_writer = std.fs.File.stdout().writerStreaming(&.{});1368 \\ var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
1369 \\ stdout_writer.interface.print("{d} {d}\n", .{ live_var1, live_var2 }) catch @panic("fail");1369 \\ stdout_writer.interface.print("{d} {d}\n", .{ live_var1, live_var2 }) catch @panic("fail");
1370 \\ live_fn2();1370 \\ live_fn2();
1371 \\}1371 \\}
test/link/macho.zig+2-2
...@@ -716,7 +716,7 @@ fn testHelloZig(b: *Build, opts: Options) *Step {...@@ -716,7 +716,7 @@ fn testHelloZig(b: *Build, opts: Options) *Step {
716 const exe = addExecutable(b, opts, .{ .name = "main", .zig_source_bytes =716 const exe = addExecutable(b, opts, .{ .name = "main", .zig_source_bytes =
717 \\const std = @import("std");717 \\const std = @import("std");
718 \\pub fn main() void {718 \\pub fn main() void {
719 \\ std.fs.File.stdout().writeAll("Hello world!\n") catch @panic("fail");719 \\ std.Io.File.stdout().writeAll("Hello world!\n") catch @panic("fail");
720 \\}720 \\}
721 });721 });
722722
...@@ -2371,7 +2371,7 @@ fn testTlsZig(b: *Build, opts: Options) *Step {...@@ -2371,7 +2371,7 @@ fn testTlsZig(b: *Build, opts: Options) *Step {
2371 \\threadlocal var x: i32 = 0;2371 \\threadlocal var x: i32 = 0;
2372 \\threadlocal var y: i32 = -1;2372 \\threadlocal var y: i32 = -1;
2373 \\pub fn main() void {2373 \\pub fn main() void {
2374 \\ var stdout_writer = std.fs.File.stdout().writerStreaming(&.{});2374 \\ var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
2375 \\ stdout_writer.interface.print("{d} {d}\n", .{x, y}) catch unreachable;2375 \\ stdout_writer.interface.print("{d} {d}\n", .{x, y}) catch unreachable;
2376 \\ x -= 1;2376 \\ x -= 1;
2377 \\ y += 1;2377 \\ y += 1;
test/link/wasm/extern/main.zig+1-1
...@@ -3,6 +3,6 @@ const std = @import("std");...@@ -3,6 +3,6 @@ const std = @import("std");
3extern const foo: u32;3extern const foo: u32;
44
5pub fn main() void {5pub fn main() void {
6 var stdout_writer = std.fs.File.stdout().writerStreaming(&.{});6 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
7 stdout_writer.interface.print("Result: {d}", .{foo}) catch {};7 stdout_writer.interface.print("Result: {d}", .{foo}) catch {};
8}8}
test/src/Cases.zig+4-2
...@@ -1,6 +1,8 @@...@@ -1,6 +1,8 @@
1const Cases = @This();1const Cases = @This();
2const builtin = @import("builtin");2const builtin = @import("builtin");
3
3const std = @import("std");4const std = @import("std");
5const Io = std.Io;
4const assert = std.debug.assert;6const assert = std.debug.assert;
5const Allocator = std.mem.Allocator;7const Allocator = std.mem.Allocator;
6const getExternalExecutor = std.zig.system.getExternalExecutor;8const getExternalExecutor = std.zig.system.getExternalExecutor;
...@@ -313,7 +315,7 @@ pub fn addCompile(...@@ -313,7 +315,7 @@ pub fn addCompile(
313/// Each file should include a test manifest as a contiguous block of comments at315/// Each file should include a test manifest as a contiguous block of comments at
314/// the end of the file. The first line should be the test type, followed by a set of316/// the end of the file. The first line should be the test type, followed by a set of
315/// key-value config values, followed by a blank line, then the expected output.317/// key-value config values, followed by a blank line, then the expected output.
316pub fn addFromDir(ctx: *Cases, dir: std.fs.Dir, b: *std.Build) void {318pub fn addFromDir(ctx: *Cases, dir: Io.Dir, b: *std.Build) void {
317 var current_file: []const u8 = "none";319 var current_file: []const u8 = "none";
318 ctx.addFromDirInner(dir, &current_file, b) catch |err| {320 ctx.addFromDirInner(dir, &current_file, b) catch |err| {
319 std.debug.panicExtra(321 std.debug.panicExtra(
...@@ -326,7 +328,7 @@ pub fn addFromDir(ctx: *Cases, dir: std.fs.Dir, b: *std.Build) void {...@@ -326,7 +328,7 @@ pub fn addFromDir(ctx: *Cases, dir: std.fs.Dir, b: *std.Build) void {
326328
327fn addFromDirInner(329fn addFromDirInner(
328 ctx: *Cases,330 ctx: *Cases,
329 iterable_dir: std.fs.Dir,331 iterable_dir: Io.Dir,
330 /// This is kept up to date with the currently being processed file so332 /// This is kept up to date with the currently being processed file so
331 /// that if any errors occur the caller knows it happened during this file.333 /// that if any errors occur the caller knows it happened during this file.
332 current_file: *[]const u8,334 current_file: *[]const u8,
test/src/convert-stack-trace.zig+1-1
...@@ -44,7 +44,7 @@ pub fn main() !void {...@@ -44,7 +44,7 @@ pub fn main() !void {
44 const in_file = try std.fs.cwd().openFile(args[1], .{});44 const in_file = try std.fs.cwd().openFile(args[1], .{});
45 defer in_file.close();45 defer in_file.close();
4646
47 const out_file: std.fs.File = .stdout();47 const out_file: std.Io.File = .stdout();
4848
49 var in_fr = in_file.reader(io, &read_buf);49 var in_fr = in_file.reader(io, &read_buf);
50 var out_fw = out_file.writer(&write_buf);50 var out_fw = out_file.writer(&write_buf);
test/standalone/child_process/child.zig+3-3
...@@ -33,12 +33,12 @@ fn run(allocator: std.mem.Allocator, io: Io) !void {...@@ -33,12 +33,12 @@ fn run(allocator: std.mem.Allocator, io: Io) !void {
33 }33 }
3434
35 // test stdout pipe; parent verifies35 // test stdout pipe; parent verifies
36 try std.fs.File.stdout().writeAll("hello from stdout");36 try std.Io.File.stdout().writeAll("hello from stdout");
3737
38 // test stdin pipe from parent38 // test stdin pipe from parent
39 const hello_stdin = "hello from stdin";39 const hello_stdin = "hello from stdin";
40 var buf: [hello_stdin.len]u8 = undefined;40 var buf: [hello_stdin.len]u8 = undefined;
41 const stdin: std.fs.File = .stdin();41 const stdin: std.Io.File = .stdin();
42 var reader = stdin.reader(io, &.{});42 var reader = stdin.reader(io, &.{});
43 const n = try reader.interface.readSliceShort(&buf);43 const n = try reader.interface.readSliceShort(&buf);
44 if (!std.mem.eql(u8, buf[0..n], hello_stdin)) {44 if (!std.mem.eql(u8, buf[0..n], hello_stdin)) {
...@@ -47,7 +47,7 @@ fn run(allocator: std.mem.Allocator, io: Io) !void {...@@ -47,7 +47,7 @@ fn run(allocator: std.mem.Allocator, io: Io) !void {
47}47}
4848
49fn testError(comptime fmt: []const u8, args: anytype) void {49fn testError(comptime fmt: []const u8, args: anytype) void {
50 var stderr_writer = std.fs.File.stderr().writer(&.{});50 var stderr_writer = std.Io.File.stderr().writer(&.{});
51 const stderr = &stderr_writer.interface;51 const stderr = &stderr_writer.interface;
52 stderr.print("CHILD TEST ERROR: ", .{}) catch {};52 stderr.print("CHILD TEST ERROR: ", .{}) catch {};
53 stderr.print(fmt, args) catch {};53 stderr.print(fmt, args) catch {};
test/standalone/child_process/main.zig+1-1
...@@ -62,7 +62,7 @@ pub fn main() !void {...@@ -62,7 +62,7 @@ pub fn main() !void {
62var parent_test_error = false;62var parent_test_error = false;
6363
64fn testError(comptime fmt: []const u8, args: anytype) void {64fn testError(comptime fmt: []const u8, args: anytype) void {
65 var stderr_writer = std.fs.File.stderr().writer(&.{});65 var stderr_writer = std.Io.File.stderr().writer(&.{});
66 const stderr = &stderr_writer.interface;66 const stderr = &stderr_writer.interface;
67 stderr.print("PARENT TEST ERROR: ", .{}) catch {};67 stderr.print("PARENT TEST ERROR: ", .{}) catch {};
68 stderr.print(fmt, args) catch {};68 stderr.print(fmt, args) catch {};
test/standalone/simple/cat/main.zig+4-4
...@@ -1,5 +1,5 @@...@@ -1,5 +1,5 @@
1const std = @import("std");1const std = @import("std");
2const fs = std.fs;2const Io = std.Io;
3const mem = std.mem;3const mem = std.mem;
4const warn = std.log.warn;4const warn = std.log.warn;
5const fatal = std.process.fatal;5const fatal = std.process.fatal;
...@@ -18,11 +18,11 @@ pub fn main() !void {...@@ -18,11 +18,11 @@ pub fn main() !void {
18 const exe = args[0];18 const exe = args[0];
19 var catted_anything = false;19 var catted_anything = false;
20 var stdout_buffer: [4096]u8 = undefined;20 var stdout_buffer: [4096]u8 = undefined;
21 var stdout_writer = fs.File.stdout().writerStreaming(&stdout_buffer);21 var stdout_writer = Io.File.stdout().writerStreaming(&stdout_buffer);
22 const stdout = &stdout_writer.interface;22 const stdout = &stdout_writer.interface;
23 var stdin_reader = fs.File.stdin().readerStreaming(io, &.{});23 var stdin_reader = Io.File.stdin().readerStreaming(io, &.{});
2424
25 const cwd = fs.cwd();25 const cwd = Io.Dir.cwd();
2626
27 for (args[1..]) |arg| {27 for (args[1..]) |arg| {
28 if (mem.eql(u8, arg, "-")) {28 if (mem.eql(u8, arg, "-")) {
test/standalone/simple/guess_number/main.zig+2-2
...@@ -2,9 +2,9 @@ const builtin = @import("builtin");...@@ -2,9 +2,9 @@ const builtin = @import("builtin");
2const std = @import("std");2const std = @import("std");
33
4pub fn main() !void {4pub fn main() !void {
5 var stdout_writer = std.fs.File.stdout().writerStreaming(&.{});5 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
6 const out = &stdout_writer.interface;6 const out = &stdout_writer.interface;
7 const stdin: std.fs.File = .stdin();7 const stdin: std.Io.File = .stdin();
88
9 try out.writeAll("Welcome to the Guess Number Game in Zig.\n");9 try out.writeAll("Welcome to the Guess Number Game in Zig.\n");
1010
test/standalone/simple/hello_world/hello.zig+1-1
...@@ -1,5 +1,5 @@...@@ -1,5 +1,5 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn main() !void {3pub fn main() !void {
4 try std.fs.File.stdout().writeAll("Hello, World!\n");4 try std.Io.File.stdout().writeAll("Hello, World!\n");
5}5}
test/standalone/windows_bat_args/echo-args.zig+1-1
...@@ -5,7 +5,7 @@ pub fn main() !void {...@@ -5,7 +5,7 @@ pub fn main() !void {
5 defer arena_state.deinit();5 defer arena_state.deinit();
6 const arena = arena_state.allocator();6 const arena = arena_state.allocator();
77
8 var stdout_writer = std.fs.File.stdout().writerStreaming(&.{});8 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
9 const stdout = &stdout_writer.interface;9 const stdout = &stdout_writer.interface;
10 var args = try std.process.argsAlloc(arena);10 var args = try std.process.argsAlloc(arena);
11 for (args[1..], 1..) |arg, i| {11 for (args[1..], 1..) |arg, i| {
test/standalone/windows_paths/relative.zig+1-1
...@@ -13,7 +13,7 @@ pub fn main() !void {...@@ -13,7 +13,7 @@ pub fn main() !void {
13 const relative = try std.fs.path.relative(allocator, args[1], args[2]);13 const relative = try std.fs.path.relative(allocator, args[1], args[2]);
14 defer allocator.free(relative);14 defer allocator.free(relative);
1515
16 var stdout_writer = std.fs.File.stdout().writerStreaming(&.{});16 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
17 const stdout = &stdout_writer.interface;17 const stdout = &stdout_writer.interface;
18 try stdout.writeAll(relative);18 try stdout.writeAll(relative);
19}19}
test/standalone/windows_spawn/hello.zig+1-1
...@@ -1,7 +1,7 @@...@@ -1,7 +1,7 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn main() !void {3pub fn main() !void {
4 var stdout_writer = std.fs.File.stdout().writerStreaming(&.{});4 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
5 const stdout = &stdout_writer.interface;5 const stdout = &stdout_writer.interface;
6 try stdout.writeAll("hello from exe\n");6 try stdout.writeAll("hello from exe\n");
7}7}
test/standalone/windows_spawn/main.zig+2-1
...@@ -1,4 +1,5 @@...@@ -1,4 +1,5 @@
1const std = @import("std");1const std = @import("std");
2const Io = std.Io;
23
3const windows = std.os.windows;4const windows = std.os.windows;
4const utf16Literal = std.unicode.utf8ToUtf16LeStringLiteral;5const utf16Literal = std.unicode.utf8ToUtf16LeStringLiteral;
...@@ -218,7 +219,7 @@ fn testExecWithCwd(allocator: std.mem.Allocator, command: []const u8, cwd: ?[]co...@@ -218,7 +219,7 @@ fn testExecWithCwd(allocator: std.mem.Allocator, command: []const u8, cwd: ?[]co
218 try std.testing.expectEqualStrings(expected_stdout, result.stdout);219 try std.testing.expectEqualStrings(expected_stdout, result.stdout);
219}220}
220221
221fn renameExe(dir: std.fs.Dir, old_sub_path: []const u8, new_sub_path: []const u8) !void {222fn renameExe(dir: Io.Dir, old_sub_path: []const u8, new_sub_path: []const u8) !void {
222 var attempt: u5 = 0;223 var attempt: u5 = 0;
223 while (true) break dir.rename(old_sub_path, new_sub_path) catch |err| switch (err) {224 while (true) break dir.rename(old_sub_path, new_sub_path) catch |err| switch (err) {
224 error.AccessDenied => {225 error.AccessDenied => {
test/tests.zig+2-1
...@@ -2629,10 +2629,11 @@ pub fn addCases(...@@ -2629,10 +2629,11 @@ pub fn addCases(
2629) !void {2629) !void {
2630 const arena = b.allocator;2630 const arena = b.allocator;
2631 const gpa = b.allocator;2631 const gpa = b.allocator;
2632 const io = b.graph.io;
26322633
2633 var cases = @import("src/Cases.zig").init(gpa, arena);2634 var cases = @import("src/Cases.zig").init(gpa, arena);
26342635
2635 var dir = try b.build_root.handle.openDir("test/cases", .{ .iterate = true });2636 var dir = try b.build_root.handle.openDir(io, "test/cases", .{ .iterate = true });
2636 defer dir.close();2637 defer dir.close();
26372638
2638 cases.addFromDir(dir, b);2639 cases.addFromDir(dir, b);