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 = .{
55pub fn main() !void {
66 var st_buf: [8]usize = undefined;
77 var buf: [1024]u8 = undefined;
8 var stdout = std.fs.File.stdout().writer(&buf);
8 var stdout = std.Io.File.stdout().writer(&buf);
99
1010 const captured_st = try foo(&stdout.interface, &st_buf);
1111 try std.debug.writeStackTrace(&captured_st, &stdout.interface, .no_color);
test/incremental/add_decl+6-6
......@@ -7,7 +7,7 @@
77#file=main.zig
88const std = @import("std");
99pub fn main() !void {
10 try std.fs.File.stdout().writeAll(foo);
10 try std.Io.File.stdout().writeAll(foo);
1111}
1212const foo = "good morning\n";
1313#expect_stdout="good morning\n"
......@@ -16,7 +16,7 @@ const foo = "good morning\n";
1616#file=main.zig
1717const std = @import("std");
1818pub fn main() !void {
19 try std.fs.File.stdout().writeAll(foo);
19 try std.Io.File.stdout().writeAll(foo);
2020}
2121const foo = "good morning\n";
2222const bar = "good evening\n";
......@@ -26,7 +26,7 @@ const bar = "good evening\n";
2626#file=main.zig
2727const std = @import("std");
2828pub fn main() !void {
29 try std.fs.File.stdout().writeAll(bar);
29 try std.Io.File.stdout().writeAll(bar);
3030}
3131const foo = "good morning\n";
3232const bar = "good evening\n";
......@@ -36,7 +36,7 @@ const bar = "good evening\n";
3636#file=main.zig
3737const std = @import("std");
3838pub fn main() !void {
39 try std.fs.File.stdout().writeAll(qux);
39 try std.Io.File.stdout().writeAll(qux);
4040}
4141const foo = "good morning\n";
4242const bar = "good evening\n";
......@@ -46,7 +46,7 @@ const bar = "good evening\n";
4646#file=main.zig
4747const std = @import("std");
4848pub fn main() !void {
49 try std.fs.File.stdout().writeAll(qux);
49 try std.Io.File.stdout().writeAll(qux);
5050}
5151const foo = "good morning\n";
5252const bar = "good evening\n";
......@@ -57,7 +57,7 @@ const qux = "good night\n";
5757#file=main.zig
5858const std = @import("std");
5959pub fn main() !void {
60 try std.fs.File.stdout().writeAll(qux);
60 try std.Io.File.stdout().writeAll(qux);
6161}
6262const qux = "good night\n";
6363#expect_stdout="good night\n"
test/incremental/add_decl_namespaced+6-6
......@@ -7,7 +7,7 @@
77#file=main.zig
88const std = @import("std");
99pub fn main() !void {
10 try std.fs.File.stdout().writeAll(@This().foo);
10 try std.Io.File.stdout().writeAll(@This().foo);
1111}
1212const foo = "good morning\n";
1313#expect_stdout="good morning\n"
......@@ -16,7 +16,7 @@ const foo = "good morning\n";
1616#file=main.zig
1717const std = @import("std");
1818pub fn main() !void {
19 try std.fs.File.stdout().writeAll(@This().foo);
19 try std.Io.File.stdout().writeAll(@This().foo);
2020}
2121const foo = "good morning\n";
2222const bar = "good evening\n";
......@@ -26,7 +26,7 @@ const bar = "good evening\n";
2626#file=main.zig
2727const std = @import("std");
2828pub fn main() !void {
29 try std.fs.File.stdout().writeAll(@This().bar);
29 try std.Io.File.stdout().writeAll(@This().bar);
3030}
3131const foo = "good morning\n";
3232const bar = "good evening\n";
......@@ -36,7 +36,7 @@ const bar = "good evening\n";
3636#file=main.zig
3737const std = @import("std");
3838pub fn main() !void {
39 try std.fs.File.stdout().writeAll(@This().qux);
39 try std.Io.File.stdout().writeAll(@This().qux);
4040}
4141const foo = "good morning\n";
4242const bar = "good evening\n";
......@@ -47,7 +47,7 @@ const bar = "good evening\n";
4747#file=main.zig
4848const std = @import("std");
4949pub fn main() !void {
50 try std.fs.File.stdout().writeAll(@This().qux);
50 try std.Io.File.stdout().writeAll(@This().qux);
5151}
5252const foo = "good morning\n";
5353const bar = "good evening\n";
......@@ -58,7 +58,7 @@ const qux = "good night\n";
5858#file=main.zig
5959const std = @import("std");
6060pub fn main() !void {
61 try std.fs.File.stdout().writeAll(@This().qux);
61 try std.Io.File.stdout().writeAll(@This().qux);
6262}
6363const qux = "good night\n";
6464#expect_stdout="good night\n"
test/incremental/bad_import+2-2
......@@ -8,7 +8,7 @@
88#file=main.zig
99pub fn main() !void {
1010 _ = @import("foo.zig");
11 try std.fs.File.stdout().writeAll("success\n");
11 try std.Io.File.stdout().writeAll("success\n");
1212}
1313const std = @import("std");
1414#file=foo.zig
......@@ -30,7 +30,7 @@ comptime {
3030#file=main.zig
3131pub fn main() !void {
3232 //_ = @import("foo.zig");
33 try std.fs.File.stdout().writeAll("success\n");
33 try std.Io.File.stdout().writeAll("success\n");
3434}
3535const std = @import("std");
3636#expect_stdout="success\n"
test/incremental/change_embed_file+3-3
......@@ -8,7 +8,7 @@
88const std = @import("std");
99const string = @embedFile("string.txt");
1010pub fn main() !void {
11 try std.fs.File.stdout().writeAll(string);
11 try std.Io.File.stdout().writeAll(string);
1212}
1313#file=string.txt
1414Hello, World!
......@@ -28,7 +28,7 @@ Hello again, World!
2828const std = @import("std");
2929const string = @embedFile("string.txt");
3030pub 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");
3232}
3333#expect_stdout="a hardcoded string\n"
3434
......@@ -37,7 +37,7 @@ pub fn main() !void {
3737const std = @import("std");
3838const string = @embedFile("string.txt");
3939pub fn main() !void {
40 try std.fs.File.stdout().writeAll(string);
40 try std.Io.File.stdout().writeAll(string);
4141}
4242#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) {
1515pub fn main() !void {
1616 var val: Foo = undefined;
1717 val = .a;
18 var stdout_writer = std.fs.File.stdout().writerStreaming(&.{});
18 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
1919 try stdout_writer.interface.print("{s}\n", .{@tagName(val)});
2020}
2121const std = @import("std");
......@@ -33,7 +33,7 @@ const Foo = enum(Tag) {
3333pub fn main() !void {
3434 var val: Foo = undefined;
3535 val = .a;
36 var stdout_writer = std.fs.File.stdout().writerStreaming(&.{});
36 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
3737 try stdout_writer.interface.print("{s}\n", .{@tagName(val)});
3838}
3939comptime {
......@@ -56,7 +56,7 @@ const Foo = enum(Tag) {
5656pub fn main() !void {
5757 var val: Foo = undefined;
5858 val = .a;
59 var stdout_writer = std.fs.File.stdout().writerStreaming(&.{});
59 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
6060 try stdout_writer.interface.print("{s}\n", .{@tagName(val)});
6161}
6262const std = @import("std");
test/incremental/change_exports+6-6
......@@ -17,7 +17,7 @@ pub fn main() !void {
1717 extern const bar: u32;
1818 };
1919 S.foo();
20 var stdout_writer = std.fs.File.stdout().writerStreaming(&.{});
20 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
2121 try stdout_writer.interface.print("{}\n", .{S.bar});
2222}
2323const std = @import("std");
......@@ -39,7 +39,7 @@ pub fn main() !void {
3939 extern const other: u32;
4040 };
4141 S.foo();
42 var stdout_writer = std.fs.File.stdout().writerStreaming(&.{});
42 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
4343 try stdout_writer.interface.print("{} {}\n", .{ S.bar, S.other });
4444}
4545const std = @import("std");
......@@ -62,7 +62,7 @@ pub fn main() !void {
6262 extern const other: u32;
6363 };
6464 S.foo();
65 var stdout_writer = std.fs.File.stdout().writerStreaming(&.{});
65 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
6666 try stdout_writer.interface.print("{} {}\n", .{ S.bar, S.other });
6767}
6868const std = @import("std");
......@@ -87,7 +87,7 @@ pub fn main() !void {
8787 extern const other: u32;
8888 };
8989 S.foo();
90 var stdout_writer = std.fs.File.stdout().writerStreaming(&.{});
90 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
9191 try stdout_writer.interface.print("{} {}\n", .{ S.bar, S.other });
9292}
9393const std = @import("std");
......@@ -133,7 +133,7 @@ pub fn main() !void {
133133 extern const other: u32;
134134 };
135135 S.foo();
136 var stdout_writer = std.fs.File.stdout().writerStreaming(&.{});
136 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
137137 try stdout_writer.interface.print("{} {}\n", .{ S.bar, S.other });
138138}
139139const std = @import("std");
......@@ -158,7 +158,7 @@ pub fn main() !void {
158158 extern const other: u32;
159159 };
160160 S.foo();
161 var stdout_writer = std.fs.File.stdout().writerStreaming(&.{});
161 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
162162 try stdout_writer.interface.print("{} {}\n", .{ S.bar, S.other });
163163}
164164const std = @import("std");
test/incremental/change_fn_type+3-3
......@@ -8,7 +8,7 @@ pub fn main() !void {
88 try foo(123);
99}
1010fn foo(x: u8) !void {
11 var stdout_writer = std.fs.File.stdout().writerStreaming(&.{});
11 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
1212 return stdout_writer.interface.print("{d}\n", .{x});
1313}
1414const std = @import("std");
......@@ -20,7 +20,7 @@ pub fn main() !void {
2020 try foo(123);
2121}
2222fn foo(x: i64) !void {
23 var stdout_writer = std.fs.File.stdout().writerStreaming(&.{});
23 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
2424 return stdout_writer.interface.print("{d}\n", .{x});
2525}
2626const std = @import("std");
......@@ -32,7 +32,7 @@ pub fn main() !void {
3232 try foo(-42);
3333}
3434fn foo(x: i64) !void {
35 var stdout_writer = std.fs.File.stdout().writerStreaming(&.{});
35 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
3636 return stdout_writer.interface.print("{d}\n", .{x});
3737}
3838const std = @import("std");
test/incremental/change_generic_line_number+2-2
......@@ -7,7 +7,7 @@ const std = @import("std");
77fn Printer(message: []const u8) type {
88 return struct {
99 fn print() !void {
10 try std.fs.File.stdout().writeAll(message);
10 try std.Io.File.stdout().writeAll(message);
1111 }
1212 };
1313}
......@@ -23,7 +23,7 @@ const std = @import("std");
2323fn Printer(message: []const u8) type {
2424 return struct {
2525 fn print() !void {
26 try std.fs.File.stdout().writeAll(message);
26 try std.Io.File.stdout().writeAll(message);
2727 }
2828 };
2929}
test/incremental/change_line_number+2-2
......@@ -5,7 +5,7 @@
55#file=main.zig
66const std = @import("std");
77pub fn main() !void {
8 try std.fs.File.stdout().writeAll("foo\n");
8 try std.Io.File.stdout().writeAll("foo\n");
99}
1010#expect_stdout="foo\n"
1111#update=change line number
......@@ -13,6 +13,6 @@ pub fn main() !void {
1313const std = @import("std");
1414
1515pub fn main() !void {
16 try std.fs.File.stdout().writeAll("foo\n");
16 try std.Io.File.stdout().writeAll("foo\n");
1717}
1818#expect_stdout="foo\n"
test/incremental/change_panic_handler+3-3
......@@ -12,7 +12,7 @@ pub fn main() !u8 {
1212}
1313pub const panic = std.debug.FullPanic(myPanic);
1414fn myPanic(msg: []const u8, _: ?usize) noreturn {
15 var stdout_writer = std.fs.File.stdout().writerStreaming(&.{});
15 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
1616 stdout_writer.interface.print("panic message: {s}\n", .{msg}) catch {};
1717 std.process.exit(0);
1818}
......@@ -29,7 +29,7 @@ pub fn main() !u8 {
2929}
3030pub const panic = std.debug.FullPanic(myPanic);
3131fn myPanic(msg: []const u8, _: ?usize) noreturn {
32 var stdout_writer = std.fs.File.stdout().writerStreaming(&.{});
32 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
3333 stdout_writer.interface.print("new panic message: {s}\n", .{msg}) catch {};
3434 std.process.exit(0);
3535}
......@@ -46,7 +46,7 @@ pub fn main() !u8 {
4646}
4747pub const panic = std.debug.FullPanic(myPanicNew);
4848fn myPanicNew(msg: []const u8, _: ?usize) noreturn {
49 var stdout_writer = std.fs.File.stdout().writerStreaming(&.{});
49 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
5050 stdout_writer.interface.print("third panic message: {s}\n", .{msg}) catch {};
5151 std.process.exit(0);
5252}
test/incremental/change_panic_handler_explicit+3-3
......@@ -42,7 +42,7 @@ pub const panic = struct {
4242 pub const noreturnReturned = no_panic.noreturnReturned;
4343};
4444fn myPanic(msg: []const u8, _: ?usize) noreturn {
45 var stdout_writer = std.fs.File.stdout().writerStreaming(&.{});
45 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
4646 stdout_writer.interface.print("panic message: {s}\n", .{msg}) catch {};
4747 std.process.exit(0);
4848}
......@@ -89,7 +89,7 @@ pub const panic = struct {
8989 pub const noreturnReturned = no_panic.noreturnReturned;
9090};
9191fn myPanic(msg: []const u8, _: ?usize) noreturn {
92 var stdout_writer = std.fs.File.stdout().writerStreaming(&.{});
92 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
9393 stdout_writer.interface.print("new panic message: {s}\n", .{msg}) catch {};
9494 std.process.exit(0);
9595}
......@@ -136,7 +136,7 @@ pub const panic = struct {
136136 pub const noreturnReturned = no_panic.noreturnReturned;
137137};
138138fn myPanicNew(msg: []const u8, _: ?usize) noreturn {
139 var stdout_writer = std.fs.File.stdout().writerStreaming(&.{});
139 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
140140 stdout_writer.interface.print("third panic message: {s}\n", .{msg}) catch {};
141141 std.process.exit(0);
142142}
test/incremental/change_shift_op+2-2
......@@ -9,7 +9,7 @@ pub fn main() !void {
99 try foo(0x1300);
1010}
1111fn foo(x: u16) !void {
12 var stdout_writer = std.fs.File.stdout().writerStreaming(&.{});
12 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
1313 try stdout_writer.interface.print("0x{x}\n", .{x << 4});
1414}
1515const std = @import("std");
......@@ -20,7 +20,7 @@ pub fn main() !void {
2020 try foo(0x1300);
2121}
2222fn foo(x: u16) !void {
23 var stdout_writer = std.fs.File.stdout().writerStreaming(&.{});
23 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
2424 try stdout_writer.interface.print("0x{x}\n", .{x >> 4});
2525}
2626const std = @import("std");
test/incremental/change_struct_same_fields+3-3
......@@ -11,7 +11,7 @@ pub fn main() !void {
1111 try foo(&val);
1212}
1313fn foo(val: *const S) !void {
14 var stdout_writer = std.fs.File.stdout().writerStreaming(&.{});
14 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
1515 try stdout_writer.interface.print(
1616 "{d} {d}\n",
1717 .{ val.x, val.y },
......@@ -28,7 +28,7 @@ pub fn main() !void {
2828 try foo(&val);
2929}
3030fn foo(val: *const S) !void {
31 var stdout_writer = std.fs.File.stdout().writerStreaming(&.{});
31 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
3232 try stdout_writer.interface.print(
3333 "{d} {d}\n",
3434 .{ val.x, val.y },
......@@ -45,7 +45,7 @@ pub fn main() !void {
4545 try foo(&val);
4646}
4747fn foo(val: *const S) !void {
48 var stdout_writer = std.fs.File.stdout().writerStreaming(&.{});
48 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
4949 try stdout_writer.interface.print(
5050 "{d} {d}\n",
5151 .{ val.x, val.y },
test/incremental/change_zon_file+3-3
......@@ -8,7 +8,7 @@
88const std = @import("std");
99const message: []const u8 = @import("message.zon");
1010pub fn main() !void {
11 try std.fs.File.stdout().writeAll(message);
11 try std.Io.File.stdout().writeAll(message);
1212}
1313#file=message.zon
1414"Hello, World!\n"
......@@ -29,7 +29,7 @@ pub fn main() !void {
2929const std = @import("std");
3030const message: []const u8 = @import("message.zon");
3131pub 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");
3333}
3434#expect_error=message.zon:1:1: error: unable to load 'message.zon': FileNotFound
3535#expect_error=main.zig:2:37: note: file imported here
......@@ -44,6 +44,6 @@ pub fn main() !void {
4444const std = @import("std");
4545const message: []const u8 = @import("message.zon");
4646pub fn main() !void {
47 try std.fs.File.stdout().writeAll(message);
47 try std.Io.File.stdout().writeAll(message);
4848}
4949#expect_stdout="We're back, World!\n"
test/incremental/change_zon_file_no_result_type+1-1
......@@ -7,7 +7,7 @@
77#file=main.zig
88const std = @import("std");
99pub 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);
1111}
1212#file=foo.zon
1313.{
test/incremental/compile_log+3-3
......@@ -8,7 +8,7 @@
88#file=main.zig
99const std = @import("std");
1010pub fn main() !void {
11 try std.fs.File.stdout().writeAll("Hello, World!\n");
11 try std.Io.File.stdout().writeAll("Hello, World!\n");
1212}
1313#expect_stdout="Hello, World!\n"
1414
......@@ -16,7 +16,7 @@ pub fn main() !void {
1616#file=main.zig
1717const std = @import("std");
1818pub fn main() !void {
19 try std.fs.File.stdout().writeAll("Hello, World!\n");
19 try std.Io.File.stdout().writeAll("Hello, World!\n");
2020 @compileLog("this is a log");
2121}
2222#expect_error=main.zig:4:5: error: found compile log statement
......@@ -26,6 +26,6 @@ pub fn main() !void {
2626#file=main.zig
2727const std = @import("std");
2828pub fn main() !void {
29 try std.fs.File.stdout().writeAll("Hello, World!\n");
29 try std.Io.File.stdout().writeAll("Hello, World!\n");
3030}
3131#expect_stdout="Hello, World!\n"
test/incremental/fix_astgen_failure+4-4
......@@ -10,21 +10,21 @@ pub fn main() !void {
1010}
1111#file=foo.zig
1212pub fn hello() !void {
13 try std.fs.File.stdout().writeAll("Hello, World!\n");
13 try std.Io.File.stdout().writeAll("Hello, World!\n");
1414}
1515#expect_error=foo.zig:2:9: error: use of undeclared identifier 'std'
1616#update=fix the error
1717#file=foo.zig
1818const std = @import("std");
1919pub fn hello() !void {
20 try std.fs.File.stdout().writeAll("Hello, World!\n");
20 try std.Io.File.stdout().writeAll("Hello, World!\n");
2121}
2222#expect_stdout="Hello, World!\n"
2323#update=add new error
2424#file=foo.zig
2525const std = @import("std");
2626pub fn hello() !void {
27 try std.fs.File.stdout().writeAll(hello_str);
27 try std.Io.File.stdout().writeAll(hello_str);
2828}
2929#expect_error=foo.zig:3:39: error: use of undeclared identifier 'hello_str'
3030#update=fix the new error
......@@ -32,6 +32,6 @@ pub fn hello() !void {
3232const std = @import("std");
3333const hello_str = "Hello, World! Again!\n";
3434pub fn hello() !void {
35 try std.fs.File.stdout().writeAll(hello_str);
35 try std.Io.File.stdout().writeAll(hello_str);
3636}
3737#expect_stdout="Hello, World! Again!\n"
test/incremental/function_becomes_inline+3-3
......@@ -8,7 +8,7 @@ pub fn main() !void {
88 try foo();
99}
1010fn foo() !void {
11 try std.fs.File.stdout().writeAll("Hello, World!\n");
11 try std.Io.File.stdout().writeAll("Hello, World!\n");
1212}
1313const std = @import("std");
1414#expect_stdout="Hello, World!\n"
......@@ -19,7 +19,7 @@ pub fn main() !void {
1919 try foo();
2020}
2121inline fn foo() !void {
22 try std.fs.File.stdout().writeAll("Hello, World!\n");
22 try std.Io.File.stdout().writeAll("Hello, World!\n");
2323}
2424const std = @import("std");
2525#expect_stdout="Hello, World!\n"
......@@ -30,7 +30,7 @@ pub fn main() !void {
3030 try foo();
3131}
3232inline 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");
3434}
3535const std = @import("std");
3636#expect_stdout="Hello, `inline` World!\n"
test/incremental/hello+2-2
......@@ -7,13 +7,13 @@
77#file=main.zig
88const std = @import("std");
99pub fn main() !void {
10 try std.fs.File.stdout().writeAll("good morning\n");
10 try std.Io.File.stdout().writeAll("good morning\n");
1111}
1212#expect_stdout="good morning\n"
1313#update=change the string
1414#file=main.zig
1515const std = @import("std");
1616pub fn main() !void {
17 try std.fs.File.stdout().writeAll("おはようございます\n");
17 try std.Io.File.stdout().writeAll("おはようございます\n");
1818}
1919#expect_stdout="おはようございます\n"
test/incremental/make_decl_pub+2-2
......@@ -12,7 +12,7 @@ pub fn main() !void {
1212#file=foo.zig
1313const std = @import("std");
1414fn hello() !void {
15 try std.fs.File.stdout().writeAll("Hello, World!\n");
15 try std.Io.File.stdout().writeAll("Hello, World!\n");
1616}
1717#expect_error=main.zig:3:12: error: 'hello' is not marked 'pub'
1818#expect_error=foo.zig:2:1: note: declared here
......@@ -21,6 +21,6 @@ fn hello() !void {
2121#file=foo.zig
2222const std = @import("std");
2323pub fn hello() !void {
24 try std.fs.File.stdout().writeAll("Hello, World!\n");
24 try std.Io.File.stdout().writeAll("Hello, World!\n");
2525}
2626#expect_stdout="Hello, World!\n"
test/incremental/modify_inline_fn+2-2
......@@ -8,7 +8,7 @@
88const std = @import("std");
99pub fn main() !void {
1010 const str = getStr();
11 try std.fs.File.stdout().writeAll(str);
11 try std.Io.File.stdout().writeAll(str);
1212}
1313inline fn getStr() []const u8 {
1414 return "foo\n";
......@@ -19,7 +19,7 @@ inline fn getStr() []const u8 {
1919const std = @import("std");
2020pub fn main() !void {
2121 const str = getStr();
22 try std.fs.File.stdout().writeAll(str);
22 try std.Io.File.stdout().writeAll(str);
2323}
2424inline fn getStr() []const u8 {
2525 return "bar\n";
test/incremental/move_src+2-2
......@@ -7,7 +7,7 @@
77#file=main.zig
88const std = @import("std");
99pub fn main() !void {
10 var stdout_writer = std.fs.File.stdout().writerStreaming(&.{});
10 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
1111 try stdout_writer.interface.print("{d} {d}\n", .{ foo(), bar() });
1212}
1313fn foo() u32 {
......@@ -22,7 +22,7 @@ fn bar() u32 {
2222#file=main.zig
2323const std = @import("std");
2424pub fn main() !void {
25 var stdout_writer = std.fs.File.stdout().writerStreaming(&.{});
25 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
2626 try stdout_writer.interface.print("{d} {d}\n", .{ foo(), bar() });
2727}
2828
test/incremental/no_change_preserves_tag_names+2-2
......@@ -8,7 +8,7 @@
88const std = @import("std");
99var some_enum: enum { first, second } = .first;
1010pub fn main() !void {
11 try std.fs.File.stdout().writeAll(@tagName(some_enum));
11 try std.Io.File.stdout().writeAll(@tagName(some_enum));
1212}
1313#expect_stdout="first"
1414#update=no change
......@@ -16,6 +16,6 @@ pub fn main() !void {
1616const std = @import("std");
1717var some_enum: enum { first, second } = .first;
1818pub fn main() !void {
19 try std.fs.File.stdout().writeAll(@tagName(some_enum));
19 try std.Io.File.stdout().writeAll(@tagName(some_enum));
2020}
2121#expect_stdout="first"
test/incremental/recursive_function_becomes_non_recursive+2-2
......@@ -9,7 +9,7 @@ pub fn main() !void {
99 try foo(false);
1010}
1111fn foo(recurse: bool) !void {
12 const stdout = std.fs.File.stdout();
12 const stdout = std.Io.File.stdout();
1313 if (recurse) return foo(true);
1414 try stdout.writeAll("non-recursive path\n");
1515}
......@@ -22,7 +22,7 @@ pub fn main() !void {
2222 try foo(true);
2323}
2424fn foo(recurse: bool) !void {
25 const stdout = std.fs.File.stdout();
25 const stdout = std.Io.File.stdout();
2626 if (recurse) return stdout.writeAll("x==1\n");
2727 try stdout.writeAll("non-recursive path\n");
2828}
test/incremental/remove_enum_field+2-2
......@@ -10,7 +10,7 @@ const MyEnum = enum(u8) {
1010 bar = 2,
1111};
1212pub fn main() !void {
13 var stdout_writer = std.fs.File.stdout().writerStreaming(&.{});
13 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
1414 try stdout_writer.interface.print("{}\n", .{@intFromEnum(MyEnum.foo)});
1515}
1616const std = @import("std");
......@@ -22,7 +22,7 @@ const MyEnum = enum(u8) {
2222 bar = 2,
2323};
2424pub fn main() !void {
25 var stdout_writer = std.fs.File.stdout().writerStreaming(&.{});
25 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
2626 try stdout_writer.interface.print("{}\n", .{@intFromEnum(MyEnum.foo)});
2727}
2828const std = @import("std");
test/incremental/unreferenced_error+4-4
......@@ -7,7 +7,7 @@
77#file=main.zig
88const std = @import("std");
99pub fn main() !void {
10 try std.fs.File.stdout().writeAll(a);
10 try std.Io.File.stdout().writeAll(a);
1111}
1212const a = "Hello, World!\n";
1313#expect_stdout="Hello, World!\n"
......@@ -16,7 +16,7 @@ const a = "Hello, World!\n";
1616#file=main.zig
1717const std = @import("std");
1818pub fn main() !void {
19 try std.fs.File.stdout().writeAll(a);
19 try std.Io.File.stdout().writeAll(a);
2020}
2121const a = @compileError("bad a");
2222#expect_error=main.zig:5:11: error: bad a
......@@ -25,7 +25,7 @@ const a = @compileError("bad a");
2525#file=main.zig
2626const std = @import("std");
2727pub fn main() !void {
28 try std.fs.File.stdout().writeAll(b);
28 try std.Io.File.stdout().writeAll(b);
2929}
3030const a = @compileError("bad a");
3131const b = "Hi there!\n";
......@@ -35,7 +35,7 @@ const b = "Hi there!\n";
3535#file=main.zig
3636const std = @import("std");
3737pub fn main() !void {
38 try std.fs.File.stdout().writeAll(a);
38 try std.Io.File.stdout().writeAll(a);
3939}
4040const a = "Back to a\n";
4141const b = @compileError("bad b");
test/link/bss/main.zig+1-1
......@@ -4,7 +4,7 @@ const std = @import("std");
44var buffer: [0x1000000]u64 = [1]u64{0} ** 0x1000000;
55
66pub fn main() anyerror!void {
7 var stdout_writer = std.fs.File.stdout().writerStreaming(&.{});
7 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
88
99 buffer[0x10] = 1;
1010
test/link/elf.zig+2-2
......@@ -1323,7 +1323,7 @@ fn testGcSectionsZig(b: *Build, opts: Options) *Step {
13231323 \\extern var live_var2: i32;
13241324 \\extern fn live_fn2() void;
13251325 \\pub fn main() void {
1326 \\ var stdout_writer = std.fs.File.stdout().writerStreaming(&.{});
1326 \\ var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
13271327 \\ stdout_writer.interface.print("{d} {d}\n", .{ live_var1, live_var2 }) catch @panic("fail");
13281328 \\ live_fn2();
13291329 \\}
......@@ -1365,7 +1365,7 @@ fn testGcSectionsZig(b: *Build, opts: Options) *Step {
13651365 \\extern var live_var2: i32;
13661366 \\extern fn live_fn2() void;
13671367 \\pub fn main() void {
1368 \\ var stdout_writer = std.fs.File.stdout().writerStreaming(&.{});
1368 \\ var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
13691369 \\ stdout_writer.interface.print("{d} {d}\n", .{ live_var1, live_var2 }) catch @panic("fail");
13701370 \\ live_fn2();
13711371 \\}
test/link/macho.zig+2-2
......@@ -716,7 +716,7 @@ fn testHelloZig(b: *Build, opts: Options) *Step {
716716 const exe = addExecutable(b, opts, .{ .name = "main", .zig_source_bytes =
717717 \\const std = @import("std");
718718 \\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");
720720 \\}
721721 });
722722
......@@ -2371,7 +2371,7 @@ fn testTlsZig(b: *Build, opts: Options) *Step {
23712371 \\threadlocal var x: i32 = 0;
23722372 \\threadlocal var y: i32 = -1;
23732373 \\pub fn main() void {
2374 \\ var stdout_writer = std.fs.File.stdout().writerStreaming(&.{});
2374 \\ var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
23752375 \\ stdout_writer.interface.print("{d} {d}\n", .{x, y}) catch unreachable;
23762376 \\ x -= 1;
23772377 \\ y += 1;
test/link/wasm/extern/main.zig+1-1
......@@ -3,6 +3,6 @@ const std = @import("std");
33extern const foo: u32;
44
55pub fn main() void {
6 var stdout_writer = std.fs.File.stdout().writerStreaming(&.{});
6 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
77 stdout_writer.interface.print("Result: {d}", .{foo}) catch {};
88}
test/src/Cases.zig+4-2
......@@ -1,6 +1,8 @@
11const Cases = @This();
22const builtin = @import("builtin");
3
34const std = @import("std");
5const Io = std.Io;
46const assert = std.debug.assert;
57const Allocator = std.mem.Allocator;
68const getExternalExecutor = std.zig.system.getExternalExecutor;
......@@ -313,7 +315,7 @@ pub fn addCompile(
313315/// Each file should include a test manifest as a contiguous block of comments at
314316/// the end of the file. The first line should be the test type, followed by a set of
315317/// 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 {
317319 var current_file: []const u8 = "none";
318320 ctx.addFromDirInner(dir, &current_file, b) catch |err| {
319321 std.debug.panicExtra(
......@@ -326,7 +328,7 @@ pub fn addFromDir(ctx: *Cases, dir: std.fs.Dir, b: *std.Build) void {
326328
327329fn addFromDirInner(
328330 ctx: *Cases,
329 iterable_dir: std.fs.Dir,
331 iterable_dir: Io.Dir,
330332 /// This is kept up to date with the currently being processed file so
331333 /// that if any errors occur the caller knows it happened during this file.
332334 current_file: *[]const u8,
test/src/convert-stack-trace.zig+1-1
......@@ -44,7 +44,7 @@ pub fn main() !void {
4444 const in_file = try std.fs.cwd().openFile(args[1], .{});
4545 defer in_file.close();
4646
47 const out_file: std.fs.File = .stdout();
47 const out_file: std.Io.File = .stdout();
4848
4949 var in_fr = in_file.reader(io, &read_buf);
5050 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 {
3333 }
3434
3535 // 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
3838 // test stdin pipe from parent
3939 const hello_stdin = "hello from stdin";
4040 var buf: [hello_stdin.len]u8 = undefined;
41 const stdin: std.fs.File = .stdin();
41 const stdin: std.Io.File = .stdin();
4242 var reader = stdin.reader(io, &.{});
4343 const n = try reader.interface.readSliceShort(&buf);
4444 if (!std.mem.eql(u8, buf[0..n], hello_stdin)) {
......@@ -47,7 +47,7 @@ fn run(allocator: std.mem.Allocator, io: Io) !void {
4747}
4848
4949fn 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(&.{});
5151 const stderr = &stderr_writer.interface;
5252 stderr.print("CHILD TEST ERROR: ", .{}) catch {};
5353 stderr.print(fmt, args) catch {};
test/standalone/child_process/main.zig+1-1
......@@ -62,7 +62,7 @@ pub fn main() !void {
6262var parent_test_error = false;
6363
6464fn 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(&.{});
6666 const stderr = &stderr_writer.interface;
6767 stderr.print("PARENT TEST ERROR: ", .{}) catch {};
6868 stderr.print(fmt, args) catch {};
test/standalone/simple/cat/main.zig+4-4
......@@ -1,5 +1,5 @@
11const std = @import("std");
2const fs = std.fs;
2const Io = std.Io;
33const mem = std.mem;
44const warn = std.log.warn;
55const fatal = std.process.fatal;
......@@ -18,11 +18,11 @@ pub fn main() !void {
1818 const exe = args[0];
1919 var catted_anything = false;
2020 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);
2222 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
2727 for (args[1..]) |arg| {
2828 if (mem.eql(u8, arg, "-")) {
test/standalone/simple/guess_number/main.zig+2-2
......@@ -2,9 +2,9 @@ const builtin = @import("builtin");
22const std = @import("std");
33
44pub fn main() !void {
5 var stdout_writer = std.fs.File.stdout().writerStreaming(&.{});
5 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
66 const out = &stdout_writer.interface;
7 const stdin: std.fs.File = .stdin();
7 const stdin: std.Io.File = .stdin();
88
99 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 @@
11const std = @import("std");
22
33pub fn main() !void {
4 try std.fs.File.stdout().writeAll("Hello, World!\n");
4 try std.Io.File.stdout().writeAll("Hello, World!\n");
55}
test/standalone/windows_bat_args/echo-args.zig+1-1
......@@ -5,7 +5,7 @@ pub fn main() !void {
55 defer arena_state.deinit();
66 const arena = arena_state.allocator();
77
8 var stdout_writer = std.fs.File.stdout().writerStreaming(&.{});
8 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
99 const stdout = &stdout_writer.interface;
1010 var args = try std.process.argsAlloc(arena);
1111 for (args[1..], 1..) |arg, i| {
test/standalone/windows_paths/relative.zig+1-1
......@@ -13,7 +13,7 @@ pub fn main() !void {
1313 const relative = try std.fs.path.relative(allocator, args[1], args[2]);
1414 defer allocator.free(relative);
1515
16 var stdout_writer = std.fs.File.stdout().writerStreaming(&.{});
16 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
1717 const stdout = &stdout_writer.interface;
1818 try stdout.writeAll(relative);
1919}
test/standalone/windows_spawn/hello.zig+1-1
......@@ -1,7 +1,7 @@
11const std = @import("std");
22
33pub fn main() !void {
4 var stdout_writer = std.fs.File.stdout().writerStreaming(&.{});
4 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
55 const stdout = &stdout_writer.interface;
66 try stdout.writeAll("hello from exe\n");
77}
test/standalone/windows_spawn/main.zig+2-1
......@@ -1,4 +1,5 @@
11const std = @import("std");
2const Io = std.Io;
23
34const windows = std.os.windows;
45const utf16Literal = std.unicode.utf8ToUtf16LeStringLiteral;
......@@ -218,7 +219,7 @@ fn testExecWithCwd(allocator: std.mem.Allocator, command: []const u8, cwd: ?[]co
218219 try std.testing.expectEqualStrings(expected_stdout, result.stdout);
219220}
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 {
222223 var attempt: u5 = 0;
223224 while (true) break dir.rename(old_sub_path, new_sub_path) catch |err| switch (err) {
224225 error.AccessDenied => {
test/tests.zig+2-1
......@@ -2629,10 +2629,11 @@ pub fn addCases(
26292629) !void {
26302630 const arena = b.allocator;
26312631 const gpa = b.allocator;
2632 const io = b.graph.io;
26322633
26332634 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 });
26362637 defer dir.close();
26372638
26382639 cases.addFromDir(dir, b);