authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-03-05 19:24:55-08:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-03-08 19:20:34-07:00
log80625990d5ce82b781de54c4587b489cbd2cd55f
tree76f7583b67d1e817efb0d2f401836d9a229aaf83
parent85ed81bb94ca59da49a128cb6ee5065b130ba06c

std: different mechanism for disabling network dependency

On Windows, it is sometimes problematic to depend on ws2_32.dll. Before, users of std.Io.Threaded would have to call ioBasic() rather than io() in order to avoid unnecessary dependencies on ws2_32.dll. Now, the application can disable networking with std.Options. This change is necessary due to moving networking functionality to be based on Io.Operation, which is a tagged union.

40 files changed, 122 insertions(+), 230 deletions(-)

lib/compiler/test_runner.zig+1-1
......@@ -17,7 +17,7 @@ var fba: std.heap.FixedBufferAllocator = .init(&fba_buffer);
1717var fba_buffer: [8192]u8 = undefined;
1818var stdin_buffer: [4096]u8 = undefined;
1919var stdout_buffer: [4096]u8 = undefined;
20const runner_threaded_io: Io = Io.Threaded.global_single_threaded.ioBasic();
20const runner_threaded_io: Io = Io.Threaded.global_single_threaded.io();
2121
2222/// Keep in sync with logic in `std.Build.addRunArtifact` which decides whether
2323/// the test runner will communicate with the build runner via `std.zig.Server`.
lib/compiler_rt.zig+1-1
......@@ -17,7 +17,7 @@ else
1717 null;
1818
1919pub const std_options_debug_io: std.Io = if (builtin.is_test)
20 std.Io.Threaded.global_single_threaded.ioBasic()
20 std.Io.Threaded.global_single_threaded.io()
2121else
2222 unreachable;
2323
lib/fuzzer.zig+1-1
......@@ -13,7 +13,7 @@ pub const std_options = std.Options{
1313 .logFn = logOverride,
1414};
1515
16const io = std.Io.Threaded.global_single_threaded.ioBasic();
16const io = std.Io.Threaded.global_single_threaded.io();
1717
1818fn logOverride(
1919 comptime level: std.log.Level,
lib/std/Io/Threaded.zig+19-147
......@@ -1908,142 +1908,10 @@ pub fn io(t: *Threaded) Io {
19081908 };
19091909}
19101910
1911/// Same as `io` but disables all networking functionality, which has
1912/// an additional dependency on Windows (ws2_32).
1913pub fn ioBasic(t: *Threaded) Io {
1914 return .{
1915 .userdata = t,
1916 .vtable = &.{
1917 .crashHandler = crashHandler,
1918
1919 .async = async,
1920 .concurrent = concurrent,
1921 .await = await,
1922 .cancel = cancel,
1923
1924 .groupAsync = groupAsync,
1925 .groupConcurrent = groupConcurrent,
1926 .groupAwait = groupAwait,
1927 .groupCancel = groupCancel,
1928
1929 .recancel = recancel,
1930 .swapCancelProtection = swapCancelProtection,
1931 .checkCancel = checkCancel,
1932
1933 .futexWait = futexWait,
1934 .futexWaitUncancelable = futexWaitUncancelable,
1935 .futexWake = futexWake,
1936
1937 .operate = operate,
1938 .batchAwaitAsync = batchAwaitAsync,
1939 .batchAwaitConcurrent = batchAwaitConcurrent,
1940 .batchCancel = batchCancel,
1941
1942 .dirCreateDir = dirCreateDir,
1943 .dirCreateDirPath = dirCreateDirPath,
1944 .dirCreateDirPathOpen = dirCreateDirPathOpen,
1945 .dirStat = dirStat,
1946 .dirStatFile = dirStatFile,
1947 .dirAccess = dirAccess,
1948 .dirCreateFile = dirCreateFile,
1949 .dirCreateFileAtomic = dirCreateFileAtomic,
1950 .dirOpenFile = dirOpenFile,
1951 .dirOpenDir = dirOpenDir,
1952 .dirClose = dirClose,
1953 .dirRead = dirRead,
1954 .dirRealPath = dirRealPath,
1955 .dirRealPathFile = dirRealPathFile,
1956 .dirDeleteFile = dirDeleteFile,
1957 .dirDeleteDir = dirDeleteDir,
1958 .dirRename = dirRename,
1959 .dirRenamePreserve = dirRenamePreserve,
1960 .dirSymLink = dirSymLink,
1961 .dirReadLink = dirReadLink,
1962 .dirSetOwner = dirSetOwner,
1963 .dirSetFileOwner = dirSetFileOwner,
1964 .dirSetPermissions = dirSetPermissions,
1965 .dirSetFilePermissions = dirSetFilePermissions,
1966 .dirSetTimestamps = dirSetTimestamps,
1967 .dirHardLink = dirHardLink,
1968
1969 .fileStat = fileStat,
1970 .fileLength = fileLength,
1971 .fileClose = fileClose,
1972 .fileWritePositional = fileWritePositional,
1973 .fileWriteFileStreaming = fileWriteFileStreaming,
1974 .fileWriteFilePositional = fileWriteFilePositional,
1975 .fileReadPositional = fileReadPositional,
1976 .fileSeekBy = fileSeekBy,
1977 .fileSeekTo = fileSeekTo,
1978 .fileSync = fileSync,
1979 .fileIsTty = fileIsTty,
1980 .fileEnableAnsiEscapeCodes = fileEnableAnsiEscapeCodes,
1981 .fileSupportsAnsiEscapeCodes = fileSupportsAnsiEscapeCodes,
1982 .fileSetLength = fileSetLength,
1983 .fileSetOwner = fileSetOwner,
1984 .fileSetPermissions = fileSetPermissions,
1985 .fileSetTimestamps = fileSetTimestamps,
1986 .fileLock = fileLock,
1987 .fileTryLock = fileTryLock,
1988 .fileUnlock = fileUnlock,
1989 .fileDowngradeLock = fileDowngradeLock,
1990 .fileRealPath = fileRealPath,
1991 .fileHardLink = fileHardLink,
1992
1993 .fileMemoryMapCreate = fileMemoryMapCreate,
1994 .fileMemoryMapDestroy = fileMemoryMapDestroy,
1995 .fileMemoryMapSetLength = fileMemoryMapSetLength,
1996 .fileMemoryMapRead = fileMemoryMapRead,
1997 .fileMemoryMapWrite = fileMemoryMapWrite,
1998
1999 .processExecutableOpen = processExecutableOpen,
2000 .processExecutablePath = processExecutablePath,
2001 .lockStderr = lockStderr,
2002 .tryLockStderr = tryLockStderr,
2003 .unlockStderr = unlockStderr,
2004 .processCurrentPath = processCurrentPath,
2005 .processSetCurrentDir = processSetCurrentDir,
2006 .processSetCurrentPath = processSetCurrentPath,
2007 .processReplace = processReplace,
2008 .processReplacePath = processReplacePath,
2009 .processSpawn = processSpawn,
2010 .processSpawnPath = processSpawnPath,
2011 .childWait = childWait,
2012 .childKill = childKill,
2013
2014 .progressParentFile = progressParentFile,
2015
2016 .now = now,
2017 .clockResolution = clockResolution,
2018 .sleep = sleep,
2019
2020 .random = random,
2021 .randomSecure = randomSecure,
2022
2023 .netListenIp = netListenIpUnavailable,
2024 .netListenUnix = netListenUnixUnavailable,
2025 .netAccept = netAcceptUnavailable,
2026 .netBindIp = netBindIpUnavailable,
2027 .netConnectIp = netConnectIpUnavailable,
2028 .netSocketCreatePair = netSocketCreatePairUnavailable,
2029 .netConnectUnix = netConnectUnixUnavailable,
2030 .netClose = netCloseUnavailable,
2031 .netShutdown = netShutdownUnavailable,
2032 .netRead = netReadUnavailable,
2033 .netWrite = netWriteUnavailable,
2034 .netWriteFile = netWriteFileUnavailable,
2035 .netSend = netSendUnavailable,
2036 .netInterfaceNameResolve = netInterfaceNameResolveUnavailable,
2037 .netInterfaceName = netInterfaceNameUnavailable,
2038 .netLookup = netLookupUnavailable,
2039 },
2040 };
2041}
2042
20431911pub const socket_flags_unsupported = is_darwin or native_os == .haiku;
20441912const have_accept4 = !socket_flags_unsupported;
20451913const have_flock_open_flags = @hasField(posix.O, "EXLOCK");
2046const have_networking = native_os != .wasi;
1914const have_networking = std.options.networking and native_os != .wasi;
20471915const have_flock = @TypeOf(posix.system.flock) != void;
20481916const have_sendmmsg = native_os == .linux;
20491917const have_futex = switch (builtin.cpu.arch) {
......@@ -2595,7 +2463,7 @@ fn futexWait(userdata: ?*anyopaque, ptr: *const u32, expected: u32, timeout: Io.
25952463 return;
25962464 }
25972465 const t: *Threaded = @ptrCast(@alignCast(userdata));
2598 const t_io = ioBasic(t);
2466 const t_io = io(t);
25992467 const timeout_ns: ?u64 = ns: {
26002468 const d = timeout.toDurationFromNow(t_io) orelse break :ns null;
26012469 break :ns std.math.lossyCast(u64, d.raw.toNanoseconds());
......@@ -2788,7 +2656,7 @@ fn batchAwaitAsync(userdata: ?*anyopaque, b: *Io.Batch) Io.Cancelable!void {
27882656fn batchAwaitConcurrent(userdata: ?*anyopaque, b: *Io.Batch, timeout: Io.Timeout) Io.Batch.AwaitConcurrentError!void {
27892657 const t: *Threaded = @ptrCast(@alignCast(userdata));
27902658 if (is_windows) {
2791 const deadline: ?Io.Clock.Timestamp = timeout.toTimestamp(ioBasic(t));
2659 const deadline: ?Io.Clock.Timestamp = timeout.toTimestamp(io(t));
27922660 try batchDrainSubmittedWindows(t, b, true);
27932661 while (b.pending.head != .none and b.completed.head == .none) {
27942662 var delay_interval: windows.LARGE_INTEGER = interval: {
......@@ -2898,7 +2766,7 @@ fn batchAwaitConcurrent(userdata: ?*anyopaque, b: *Io.Batch, timeout: Io.Timeout
28982766 },
28992767 else => {},
29002768 }
2901 const t_io = ioBasic(t);
2769 const t_io = io(t);
29022770 const deadline = timeout.toTimestamp(t_io);
29032771 while (true) {
29042772 const timeout_ms: i32 = t: {
......@@ -3536,7 +3404,7 @@ fn dirCreateDirPathOpenPosix(
35363404 options: Dir.OpenOptions,
35373405) Dir.CreateDirPathOpenError!Dir {
35383406 const t: *Threaded = @ptrCast(@alignCast(userdata));
3539 const t_io = ioBasic(t);
3407 const t_io = io(t);
35403408 return dirOpenDirPosix(t, dir, sub_path, options) catch |err| switch (err) {
35413409 error.FileNotFound => {
35423410 _ = try dir.createDirPathStatus(t_io, sub_path, permissions);
......@@ -3657,7 +3525,7 @@ fn dirCreateDirPathOpenWasi(
36573525 options: Dir.OpenOptions,
36583526) Dir.CreateDirPathOpenError!Dir {
36593527 const t: *Threaded = @ptrCast(@alignCast(userdata));
3660 const t_io = ioBasic(t);
3528 const t_io = io(t);
36613529 return dirOpenDirWasi(t, dir, sub_path, options) catch |err| switch (err) {
36623530 error.FileNotFound => {
36633531 _ = try dir.createDirPathStatus(t_io, sub_path, permissions);
......@@ -4698,7 +4566,7 @@ fn dirCreateFileAtomic(
46984566 options: Dir.CreateFileAtomicOptions,
46994567) Dir.CreateFileAtomicError!File.Atomic {
47004568 const t: *Threaded = @ptrCast(@alignCast(userdata));
4701 const t_io = ioBasic(t);
4569 const t_io = io(t);
47024570
47034571 // Linux has O_TMPFILE, but linkat() does not support AT_REPLACE, so it's
47044572 // useless when we have to make up a bogus path name to do the rename()
......@@ -10326,19 +10194,19 @@ fn processExecutablePath(userdata: ?*anyopaque, out_buffer: []u8) process.Execut
1032610194 const rc = std.c._NSGetExecutablePath(&symlink_path_buf, &n);
1032710195 if (rc != 0) return error.NameTooLong;
1032810196 const symlink_path = std.mem.sliceTo(&symlink_path_buf, 0);
10329 return Io.Dir.realPathFileAbsolute(ioBasic(t), symlink_path, out_buffer) catch |err| switch (err) {
10197 return Io.Dir.realPathFileAbsolute(io(t), symlink_path, out_buffer) catch |err| switch (err) {
1033010198 error.NetworkNotFound => unreachable, // Windows-only
1033110199 error.FileBusy => unreachable, // Windows-only
1033210200 else => |e| return e,
1033310201 };
1033410202 },
10335 .linux, .serenity => return Io.Dir.readLinkAbsolute(ioBasic(t), "/proc/self/exe", out_buffer) catch |err| switch (err) {
10203 .linux, .serenity => return Io.Dir.readLinkAbsolute(io(t), "/proc/self/exe", out_buffer) catch |err| switch (err) {
1033610204 error.UnsupportedReparsePointType => unreachable, // Windows-only
1033710205 error.NetworkNotFound => unreachable, // Windows-only
1033810206 error.FileBusy => unreachable, // Windows-only
1033910207 else => |e| return e,
1034010208 },
10341 .illumos => return Io.Dir.readLinkAbsolute(ioBasic(t), "/proc/self/path/a.out", out_buffer) catch |err| switch (err) {
10209 .illumos => return Io.Dir.readLinkAbsolute(io(t), "/proc/self/path/a.out", out_buffer) catch |err| switch (err) {
1034210210 error.UnsupportedReparsePointType => unreachable, // Windows-only
1034310211 error.NetworkNotFound => unreachable, // Windows-only
1034410212 error.FileBusy => unreachable, // Windows-only
......@@ -11700,7 +11568,7 @@ fn sleepPosix(timeout: Io.Timeout) Io.Cancelable!void {
1170011568}
1170111569
1170211570fn sleepWasi(t: *Threaded, timeout: Io.Timeout) Io.Cancelable!void {
11703 const t_io = ioBasic(t);
11571 const t_io = io(t);
1170411572 const w = std.os.wasi;
1170511573
1170611574 const clock: w.subscription_clock_t = if (timeout.toDurationFromNow(t_io)) |d| .{
......@@ -11729,7 +11597,7 @@ fn sleepWasi(t: *Threaded, timeout: Io.Timeout) Io.Cancelable!void {
1172911597}
1173011598
1173111599fn sleepNanosleep(t: *Threaded, timeout: Io.Timeout) Io.Cancelable!void {
11732 const t_io = ioBasic(t);
11600 const t_io = io(t);
1173311601 const sec_type = @typeInfo(posix.timespec).@"struct".fields[0].type;
1173411602 const nsec_type = @typeInfo(posix.timespec).@"struct".fields[1].type;
1173511603
......@@ -11961,6 +11829,7 @@ fn netListenUnixWindows(
1196111829 options: net.UnixAddress.ListenOptions,
1196211830) net.UnixAddress.ListenError!net.Socket.Handle {
1196311831 if (!net.has_unix_sockets) return error.AddressFamilyUnsupported;
11832 if (!have_networking) return error.NetworkDown;
1196411833 const t: *Threaded = @ptrCast(@alignCast(userdata));
1196511834
1196611835 const socket_handle = openSocketWsa(t, posix.AF.UNIX, .{ .mode = .stream }) catch |err| switch (err) {
......@@ -12457,6 +12326,7 @@ fn netConnectUnixWindows(
1245712326 address: *const net.UnixAddress,
1245812327) net.UnixAddress.ConnectError!net.Socket.Handle {
1245912328 if (!net.has_unix_sockets) return error.AddressFamilyUnsupported;
12329 if (!have_networking) return error.NetworkDown;
1246012330 const t: *Threaded = @ptrCast(@alignCast(userdata));
1246112331
1246212332 const socket_handle = try openSocketWsa(t, posix.AF.UNIX, .{ .mode = .stream });
......@@ -13426,7 +13296,7 @@ fn netReceiveWindowsOne(
1342613296 data_buffer: []u8,
1342713297 flags: net.ReceiveFlags,
1342813298) net.Socket.ReceiveError!void {
13429 comptime assert(have_networking);
13299 if (!have_networking) return error.NetworkDown;
1343013300
1343113301 var windows_flags: u32 =
1343213302 @as(u32, if (flags.oob) ws2_32.MSG.OOB else 0) |
......@@ -13601,6 +13471,7 @@ fn netWriteWindows(
1360113471 data: []const []const u8,
1360213472 splat: usize,
1360313473) net.Stream.Writer.Error!usize {
13474 if (!have_networking) return error.NetworkDown;
1360413475 const t: *Threaded = @ptrCast(@alignCast(userdata));
1360513476 comptime assert(is_windows);
1360613477
......@@ -13723,6 +13594,7 @@ fn addBuf(v: []posix.iovec_const, i: *iovlen_t, bytes: []const u8) void {
1372313594}
1372413595
1372513596fn netClose(userdata: ?*anyopaque, handles: []const net.Socket.Handle) void {
13597 if (!have_networking) unreachable;
1372613598 const t: *Threaded = @ptrCast(@alignCast(userdata));
1372713599 _ = t;
1372813600 switch (native_os) {
......@@ -13931,7 +13803,7 @@ fn netLookupUnavailable(
1393113803 _ = host_name;
1393213804 _ = options;
1393313805 const t: *Threaded = @ptrCast(@alignCast(userdata));
13934 resolved.close(ioBasic(t));
13806 resolved.close(io(t));
1393513807 return error.NetworkDown;
1393613808}
1393713809
......@@ -14214,7 +14086,7 @@ fn tryLockStderr(userdata: ?*anyopaque, terminal_mode: ?Io.Terminal.Mode) Io.Can
1421414086
1421514087fn initLockedStderr(t: *Threaded, terminal_mode: ?Io.Terminal.Mode) Io.Cancelable!Io.LockedStderr {
1421614088 if (!t.stderr_writer_initialized) {
14217 const io_t = ioBasic(t);
14089 const io_t = io(t);
1421814090 if (is_windows) t.stderr_writer.file = .stderr();
1421914091 t.stderr_writer.io = io_t;
1422014092 t.stderr_writer_initialized = true;
lib/std/std.zig+4-1
......@@ -174,6 +174,9 @@ pub const Options = struct {
174174 /// stack traces will just print an error to the relevant `Io.Writer` and return.
175175 allow_stack_tracing: bool = !@import("builtin").strip_debug_info,
176176
177 /// Allows disabling networking in std.Io implementations.
178 networking: bool = true,
179
177180 /// TODO This is a separate decl instead of a field as a workaround around
178181 /// compilation errors due to zig not being lazy enough.
179182 pub const logTerminalMode: fn () Io.Terminal.Mode = log.defaultTerminalMode;
......@@ -202,7 +205,7 @@ pub const Options = struct {
202205 /// implementation based on coroutines, one likely wants `std.debug.print`
203206 /// to directly write to stderr without trying to interact with the code
204207 /// being debugged.
205 pub const debug_io: Io = if (@hasDecl(root, "std_options_debug_io")) root.std_options_debug_io else debug_threaded_io.?.ioBasic();
208 pub const debug_io: Io = if (@hasDecl(root, "std_options_debug_io")) root.std_options_debug_io else debug_threaded_io.?.io();
206209
207210 /// Overrides `std.Io.File.Permissions`.
208211 pub const FilePermissions: ?type = if (@hasDecl(root, "std_options_FilePermissions")) root.std_options_FilePermissions else null;
lib/ubsan_rt.zig+4
......@@ -3,6 +3,10 @@ const builtin = @import("builtin");
33const assert = std.debug.assert;
44const panic = std.debug.panicExtra;
55
6pub const std_options: std.Options = .{
7 .networking = false,
8};
9
610const SourceLocation = extern struct {
711 file_name: ?[*:0]const u8,
812 line: u32,
test/incremental/add_decl+6-6
......@@ -10,7 +10,7 @@ pub fn main() !void {
1010 try std.Io.File.stdout().writeStreamingAll(io, foo);
1111}
1212const foo = "good morning\n";
13const io = std.Io.Threaded.global_single_threaded.ioBasic();
13const io = std.Io.Threaded.global_single_threaded.io();
1414#expect_stdout="good morning\n"
1515
1616#update=add new declaration
......@@ -21,7 +21,7 @@ pub fn main() !void {
2121}
2222const foo = "good morning\n";
2323const bar = "good evening\n";
24const io = std.Io.Threaded.global_single_threaded.ioBasic();
24const io = std.Io.Threaded.global_single_threaded.io();
2525#expect_stdout="good morning\n"
2626
2727#update=reference new declaration
......@@ -32,7 +32,7 @@ pub fn main() !void {
3232}
3333const foo = "good morning\n";
3434const bar = "good evening\n";
35const io = std.Io.Threaded.global_single_threaded.ioBasic();
35const io = std.Io.Threaded.global_single_threaded.io();
3636#expect_stdout="good evening\n"
3737
3838#update=reference missing declaration
......@@ -43,7 +43,7 @@ pub fn main() !void {
4343}
4444const foo = "good morning\n";
4545const bar = "good evening\n";
46const io = std.Io.Threaded.global_single_threaded.ioBasic();
46const io = std.Io.Threaded.global_single_threaded.io();
4747#expect_error=main.zig:3:52: error: use of undeclared identifier 'qux'
4848
4949#update=add missing declaration
......@@ -55,7 +55,7 @@ pub fn main() !void {
5555const foo = "good morning\n";
5656const bar = "good evening\n";
5757const qux = "good night\n";
58const io = std.Io.Threaded.global_single_threaded.ioBasic();
58const io = std.Io.Threaded.global_single_threaded.io();
5959#expect_stdout="good night\n"
6060
6161#update=remove unused declarations
......@@ -65,5 +65,5 @@ pub fn main() !void {
6565 try std.Io.File.stdout().writeStreamingAll(io, qux);
6666}
6767const qux = "good night\n";
68const io = std.Io.Threaded.global_single_threaded.ioBasic();
68const io = std.Io.Threaded.global_single_threaded.io();
6969#expect_stdout="good night\n"
test/incremental/add_decl_namespaced+6-6
......@@ -10,7 +10,7 @@ pub fn main() !void {
1010 try std.Io.File.stdout().writeStreamingAll(io, @This().foo);
1111}
1212const foo = "good morning\n";
13const io = std.Io.Threaded.global_single_threaded.ioBasic();
13const io = std.Io.Threaded.global_single_threaded.io();
1414#expect_stdout="good morning\n"
1515
1616#update=add new declaration
......@@ -21,7 +21,7 @@ pub fn main() !void {
2121}
2222const foo = "good morning\n";
2323const bar = "good evening\n";
24const io = std.Io.Threaded.global_single_threaded.ioBasic();
24const io = std.Io.Threaded.global_single_threaded.io();
2525#expect_stdout="good morning\n"
2626
2727#update=reference new declaration
......@@ -32,7 +32,7 @@ pub fn main() !void {
3232}
3333const foo = "good morning\n";
3434const bar = "good evening\n";
35const io = std.Io.Threaded.global_single_threaded.ioBasic();
35const io = std.Io.Threaded.global_single_threaded.io();
3636#expect_stdout="good evening\n"
3737
3838#update=reference missing declaration
......@@ -43,7 +43,7 @@ pub fn main() !void {
4343}
4444const foo = "good morning\n";
4545const bar = "good evening\n";
46const io = std.Io.Threaded.global_single_threaded.ioBasic();
46const io = std.Io.Threaded.global_single_threaded.io();
4747#expect_error=main.zig:3:59: error: root source file struct 'main' has no member named 'qux'
4848#expect_error=main.zig:1:1: note: struct declared here
4949
......@@ -56,7 +56,7 @@ pub fn main() !void {
5656const foo = "good morning\n";
5757const bar = "good evening\n";
5858const qux = "good night\n";
59const io = std.Io.Threaded.global_single_threaded.ioBasic();
59const io = std.Io.Threaded.global_single_threaded.io();
6060#expect_stdout="good night\n"
6161
6262#update=remove unused declarations
......@@ -66,5 +66,5 @@ pub fn main() !void {
6666 try std.Io.File.stdout().writeStreamingAll(io, @This().qux);
6767}
6868const qux = "good night\n";
69const io = std.Io.Threaded.global_single_threaded.ioBasic();
69const io = std.Io.Threaded.global_single_threaded.io();
7070#expect_stdout="good night\n"
test/incremental/bad_import+2-2
......@@ -11,7 +11,7 @@ pub fn main() !void {
1111 try std.Io.File.stdout().writeStreamingAll(io, "success\n");
1212}
1313const std = @import("std");
14const io = std.Io.Threaded.global_single_threaded.ioBasic();
14const io = std.Io.Threaded.global_single_threaded.io();
1515#file=foo.zig
1616comptime {
1717 _ = @import("bad.zig");
......@@ -34,5 +34,5 @@ pub fn main() !void {
3434 try std.Io.File.stdout().writeStreamingAll(io, "success\n");
3535}
3636const std = @import("std");
37const io = std.Io.Threaded.global_single_threaded.ioBasic();
37const io = std.Io.Threaded.global_single_threaded.io();
3838#expect_stdout="success\n"
test/incremental/change_embed_file+3-3
......@@ -10,7 +10,7 @@ const string = @embedFile("string.txt");
1010pub fn main() !void {
1111 try std.Io.File.stdout().writeStreamingAll(io, string);
1212}
13const io = std.Io.Threaded.global_single_threaded.ioBasic();
13const io = std.Io.Threaded.global_single_threaded.io();
1414#file=string.txt
1515Hello, World!
1616#expect_stdout="Hello, World!\n"
......@@ -31,7 +31,7 @@ const string = @embedFile("string.txt");
3131pub fn main() !void {
3232 try std.Io.File.stdout().writeStreamingAll(io, "a hardcoded string\n");
3333}
34const io = std.Io.Threaded.global_single_threaded.ioBasic();
34const io = std.Io.Threaded.global_single_threaded.io();
3535#expect_stdout="a hardcoded string\n"
3636
3737#update=re-introduce reference to file
......@@ -41,7 +41,7 @@ const string = @embedFile("string.txt");
4141pub fn main() !void {
4242 try std.Io.File.stdout().writeStreamingAll(io, string);
4343}
44const io = std.Io.Threaded.global_single_threaded.ioBasic();
44const io = std.Io.Threaded.global_single_threaded.io();
4545#expect_error=main.zig:2:27: error: unable to open 'string.txt': FileNotFound
4646
4747#update=recreate file
test/incremental/change_enum_tag_type+3-3
......@@ -19,7 +19,7 @@ pub fn main() !void {
1919 try stdout_writer.interface.print("{s}\n", .{@tagName(val)});
2020}
2121const std = @import("std");
22const io = std.Io.Threaded.global_single_threaded.ioBasic();
22const io = std.Io.Threaded.global_single_threaded.io();
2323#expect_stdout="a\n"
2424#update=too many enum fields
2525#file=main.zig
......@@ -43,7 +43,7 @@ comptime {
4343 std.debug.assert(@TypeOf(@intFromEnum(Foo.e)) == Tag);
4444}
4545const std = @import("std");
46const io = std.Io.Threaded.global_single_threaded.ioBasic();
46const io = std.Io.Threaded.global_single_threaded.io();
4747#expect_error=main.zig:7:5: error: enumeration value '4' too large for type 'u2'
4848#update=increase tag size
4949#file=main.zig
......@@ -62,5 +62,5 @@ pub fn main() !void {
6262 try stdout_writer.interface.print("{s}\n", .{@tagName(val)});
6363}
6464const std = @import("std");
65const io = std.Io.Threaded.global_single_threaded.ioBasic();
65const io = std.Io.Threaded.global_single_threaded.io();
6666#expect_stdout="a\n"
test/incremental/change_exports+6-6
......@@ -21,7 +21,7 @@ pub fn main() !void {
2121 try stdout_writer.interface.print("{}\n", .{S.bar});
2222}
2323const std = @import("std");
24const io = std.Io.Threaded.global_single_threaded.ioBasic();
24const io = std.Io.Threaded.global_single_threaded.io();
2525#expect_stdout="123\n"
2626
2727#update=add conflict
......@@ -44,7 +44,7 @@ pub fn main() !void {
4444 try stdout_writer.interface.print("{} {}\n", .{ S.bar, S.other });
4545}
4646const std = @import("std");
47const io = std.Io.Threaded.global_single_threaded.ioBasic();
47const io = std.Io.Threaded.global_single_threaded.io();
4848#expect_error=main.zig:6:5: error: exported symbol collision: foo
4949#expect_error=main.zig:1:1: note: other symbol here
5050
......@@ -68,7 +68,7 @@ pub fn main() !void {
6868 try stdout_writer.interface.print("{} {}\n", .{ S.bar, S.other });
6969}
7070const std = @import("std");
71const io = std.Io.Threaded.global_single_threaded.ioBasic();
71const io = std.Io.Threaded.global_single_threaded.io();
7272#expect_stdout="123 456\n"
7373
7474#update=put exports in decl
......@@ -94,7 +94,7 @@ pub fn main() !void {
9494 try stdout_writer.interface.print("{} {}\n", .{ S.bar, S.other });
9595}
9696const std = @import("std");
97const io = std.Io.Threaded.global_single_threaded.ioBasic();
97const io = std.Io.Threaded.global_single_threaded.io();
9898#expect_stdout="123 456\n"
9999
100100#update=remove reference to exporting decl
......@@ -141,7 +141,7 @@ pub fn main() !void {
141141 try stdout_writer.interface.print("{} {}\n", .{ S.bar, S.other });
142142}
143143const std = @import("std");
144const io = std.Io.Threaded.global_single_threaded.ioBasic();
144const io = std.Io.Threaded.global_single_threaded.io();
145145#expect_stdout="123 456\n"
146146
147147#update=reintroduce reference to exporting decl, introducing conflict
......@@ -167,7 +167,7 @@ pub fn main() !void {
167167 try stdout_writer.interface.print("{} {}\n", .{ S.bar, S.other });
168168}
169169const std = @import("std");
170const io = std.Io.Threaded.global_single_threaded.ioBasic();
170const io = std.Io.Threaded.global_single_threaded.io();
171171#expect_error=main.zig:5:5: error: exported symbol collision: bar
172172#expect_error=main.zig:2:1: note: other symbol here
173173#expect_error=main.zig:6:5: error: exported symbol collision: other
test/incremental/change_fn_type+3-3
......@@ -12,7 +12,7 @@ fn foo(x: u8) !void {
1212 return stdout_writer.interface.print("{d}\n", .{x});
1313}
1414const std = @import("std");
15const io = std.Io.Threaded.global_single_threaded.ioBasic();
15const io = std.Io.Threaded.global_single_threaded.io();
1616#expect_stdout="123\n"
1717
1818#update=change function type
......@@ -25,7 +25,7 @@ fn foo(x: i64) !void {
2525 return stdout_writer.interface.print("{d}\n", .{x});
2626}
2727const std = @import("std");
28const io = std.Io.Threaded.global_single_threaded.ioBasic();
28const io = std.Io.Threaded.global_single_threaded.io();
2929#expect_stdout="123\n"
3030
3131#update=change function argument
......@@ -38,5 +38,5 @@ fn foo(x: i64) !void {
3838 return stdout_writer.interface.print("{d}\n", .{x});
3939}
4040const std = @import("std");
41const io = std.Io.Threaded.global_single_threaded.ioBasic();
41const io = std.Io.Threaded.global_single_threaded.io();
4242#expect_stdout="-42\n"
test/incremental/change_generic_line_number+2-2
......@@ -4,7 +4,7 @@
44#update=initial version
55#file=main.zig
66const std = @import("std");
7const io = std.Io.Threaded.global_single_threaded.ioBasic();
7const io = std.Io.Threaded.global_single_threaded.io();
88fn Printer(message: []const u8) type {
99 return struct {
1010 fn print() !void {
......@@ -20,7 +20,7 @@ pub fn main() !void {
2020#update=change line number
2121#file=main.zig
2222const std = @import("std");
23const io = std.Io.Threaded.global_single_threaded.ioBasic();
23const io = std.Io.Threaded.global_single_threaded.io();
2424
2525fn Printer(message: []const u8) type {
2626 return struct {
test/incremental/change_line_number+2-2
......@@ -7,7 +7,7 @@ const std = @import("std");
77pub fn main() !void {
88 try std.Io.File.stdout().writeStreamingAll(io, "foo\n");
99}
10const io = std.Io.Threaded.global_single_threaded.ioBasic();
10const io = std.Io.Threaded.global_single_threaded.io();
1111#expect_stdout="foo\n"
1212#update=change line number
1313#file=main.zig
......@@ -16,5 +16,5 @@ const std = @import("std");
1616pub fn main() !void {
1717 try std.Io.File.stdout().writeStreamingAll(io, "foo\n");
1818}
19const io = std.Io.Threaded.global_single_threaded.ioBasic();
19const io = std.Io.Threaded.global_single_threaded.io();
2020#expect_stdout="foo\n"
test/incremental/change_panic_handler+3-3
......@@ -17,7 +17,7 @@ fn myPanic(msg: []const u8, _: ?usize) noreturn {
1717 std.process.exit(0);
1818}
1919const std = @import("std");
20const io = std.Io.Threaded.global_single_threaded.ioBasic();
20const io = std.Io.Threaded.global_single_threaded.io();
2121#expect_stdout="panic message: integer overflow\n"
2222
2323#update=change the panic handler body
......@@ -35,7 +35,7 @@ fn myPanic(msg: []const u8, _: ?usize) noreturn {
3535 std.process.exit(0);
3636}
3737const std = @import("std");
38const io = std.Io.Threaded.global_single_threaded.ioBasic();
38const io = std.Io.Threaded.global_single_threaded.io();
3939#expect_stdout="new panic message: integer overflow\n"
4040
4141#update=change the panic handler function value
......@@ -53,5 +53,5 @@ fn myPanicNew(msg: []const u8, _: ?usize) noreturn {
5353 std.process.exit(0);
5454}
5555const std = @import("std");
56const io = std.Io.Threaded.global_single_threaded.ioBasic();
56const io = std.Io.Threaded.global_single_threaded.io();
5757#expect_stdout="third panic message: integer overflow\n"
test/incremental/change_panic_handler_explicit+3-3
......@@ -47,7 +47,7 @@ fn myPanic(msg: []const u8, _: ?usize) noreturn {
4747 std.process.exit(0);
4848}
4949const std = @import("std");
50const io = std.Io.Threaded.global_single_threaded.ioBasic();
50const io = std.Io.Threaded.global_single_threaded.io();
5151#expect_stdout="panic message: integer overflow\n"
5252
5353#update=change the panic handler body
......@@ -95,7 +95,7 @@ fn myPanic(msg: []const u8, _: ?usize) noreturn {
9595 std.process.exit(0);
9696}
9797const std = @import("std");
98const io = std.Io.Threaded.global_single_threaded.ioBasic();
98const io = std.Io.Threaded.global_single_threaded.io();
9999#expect_stdout="new panic message: integer overflow\n"
100100
101101#update=change the panic handler function value
......@@ -143,5 +143,5 @@ fn myPanicNew(msg: []const u8, _: ?usize) noreturn {
143143 std.process.exit(0);
144144}
145145const std = @import("std");
146const io = std.Io.Threaded.global_single_threaded.ioBasic();
146const io = std.Io.Threaded.global_single_threaded.io();
147147#expect_stdout="third panic message: integer overflow\n"
test/incremental/change_shift_op+2-2
......@@ -13,7 +13,7 @@ fn foo(x: u16) !void {
1313 try stdout_writer.interface.print("0x{x}\n", .{x << 4});
1414}
1515const std = @import("std");
16const io = std.Io.Threaded.global_single_threaded.ioBasic();
16const io = std.Io.Threaded.global_single_threaded.io();
1717#expect_stdout="0x3000\n"
1818#update=change to right shift
1919#file=main.zig
......@@ -25,5 +25,5 @@ fn foo(x: u16) !void {
2525 try stdout_writer.interface.print("0x{x}\n", .{x >> 4});
2626}
2727const std = @import("std");
28const io = std.Io.Threaded.global_single_threaded.ioBasic();
28const io = std.Io.Threaded.global_single_threaded.io();
2929#expect_stdout="0x130\n"
test/incremental/change_struct_same_fields+3-3
......@@ -18,7 +18,7 @@ fn foo(val: *const S) !void {
1818 );
1919}
2020const std = @import("std");
21const io = std.Io.Threaded.global_single_threaded.ioBasic();
21const io = std.Io.Threaded.global_single_threaded.io();
2222#expect_stdout="100 200\n"
2323
2424#update=change struct layout
......@@ -36,7 +36,7 @@ fn foo(val: *const S) !void {
3636 );
3737}
3838const std = @import("std");
39const io = std.Io.Threaded.global_single_threaded.ioBasic();
39const io = std.Io.Threaded.global_single_threaded.io();
4040#expect_stdout="100 200\n"
4141
4242#update=change values
......@@ -54,5 +54,5 @@ fn foo(val: *const S) !void {
5454 );
5555}
5656const std = @import("std");
57const io = std.Io.Threaded.global_single_threaded.ioBasic();
57const io = std.Io.Threaded.global_single_threaded.io();
5858#expect_stdout="1234 5678\n"
test/incremental/change_zon_file+3-3
......@@ -10,7 +10,7 @@ const message: []const u8 = @import("message.zon");
1010pub fn main() !void {
1111 try std.Io.File.stdout().writeStreamingAll(io, message);
1212}
13const io = std.Io.Threaded.global_single_threaded.ioBasic();
13const io = std.Io.Threaded.global_single_threaded.io();
1414#file=message.zon
1515"Hello, World!\n"
1616#expect_stdout="Hello, World!\n"
......@@ -32,7 +32,7 @@ const message: []const u8 = @import("message.zon");
3232pub fn main() !void {
3333 try std.Io.File.stdout().writeStreamingAll(io, "a hardcoded string\n");
3434}
35const io = std.Io.Threaded.global_single_threaded.ioBasic();
35const io = std.Io.Threaded.global_single_threaded.io();
3636#expect_error=message.zon:1:1: error: unable to load 'message.zon': FileNotFound
3737#expect_error=main.zig:2:37: note: file imported here
3838
......@@ -48,5 +48,5 @@ const message: []const u8 = @import("message.zon");
4848pub fn main() !void {
4949 try std.Io.File.stdout().writeStreamingAll(io, message);
5050}
51const io = std.Io.Threaded.global_single_threaded.ioBasic();
51const io = std.Io.Threaded.global_single_threaded.io();
5252#expect_stdout="We're back, World!\n"
test/incremental/change_zon_file_no_result_type+1-1
......@@ -6,7 +6,7 @@
66#update=initial version
77#file=main.zig
88const std = @import("std");
9const io = std.Io.Threaded.global_single_threaded.ioBasic();
9const io = std.Io.Threaded.global_single_threaded.io();
1010pub fn main() !void {
1111 try std.Io.File.stdout().writeStreamingAll(io, @import("foo.zon").message);
1212}
test/incremental/compile_log+3-3
......@@ -10,7 +10,7 @@ const std = @import("std");
1010pub fn main() !void {
1111 try std.Io.File.stdout().writeStreamingAll(io, "Hello, World!\n");
1212}
13const io = std.Io.Threaded.global_single_threaded.ioBasic();
13const io = std.Io.Threaded.global_single_threaded.io();
1414#expect_stdout="Hello, World!\n"
1515
1616#update=add compile log
......@@ -20,7 +20,7 @@ pub fn main() !void {
2020 try std.Io.File.stdout().writeStreamingAll(io, "Hello, World!\n");
2121 @compileLog("this is a log");
2222}
23const io = std.Io.Threaded.global_single_threaded.ioBasic();
23const io = std.Io.Threaded.global_single_threaded.io();
2424#expect_error=main.zig:4:5: error: found compile log statement
2525#expect_compile_log=@as(*const [13:0]u8, "this is a log")
2626
......@@ -30,5 +30,5 @@ const std = @import("std");
3030pub fn main() !void {
3131 try std.Io.File.stdout().writeStreamingAll(io, "Hello, World!\n");
3232}
33const io = std.Io.Threaded.global_single_threaded.ioBasic();
33const io = std.Io.Threaded.global_single_threaded.io();
3434#expect_stdout="Hello, World!\n"
test/incremental/fix_astgen_failure+3-3
......@@ -19,7 +19,7 @@ const std = @import("std");
1919pub fn hello() !void {
2020 try std.Io.File.stdout().writeStreamingAll(io, "Hello, World!\n");
2121}
22const io = std.Io.Threaded.global_single_threaded.ioBasic();
22const io = std.Io.Threaded.global_single_threaded.io();
2323#expect_stdout="Hello, World!\n"
2424#update=add new error
2525#file=foo.zig
......@@ -27,7 +27,7 @@ const std = @import("std");
2727pub fn hello() !void {
2828 try std.Io.File.stdout().writeStreamingAll(io, hello_str);
2929}
30const io = std.Io.Threaded.global_single_threaded.ioBasic();
30const io = std.Io.Threaded.global_single_threaded.io();
3131#expect_error=foo.zig:3:52: error: use of undeclared identifier 'hello_str'
3232#update=fix the new error
3333#file=foo.zig
......@@ -36,5 +36,5 @@ const hello_str = "Hello, World! Again!\n";
3636pub fn hello() !void {
3737 try std.Io.File.stdout().writeStreamingAll(io, hello_str);
3838}
39const io = std.Io.Threaded.global_single_threaded.ioBasic();
39const io = std.Io.Threaded.global_single_threaded.io();
4040#expect_stdout="Hello, World! Again!\n"
test/incremental/function_becomes_inline+3-3
......@@ -11,7 +11,7 @@ fn foo() !void {
1111 try std.Io.File.stdout().writeStreamingAll(io, "Hello, World!\n");
1212}
1313const std = @import("std");
14const io = std.Io.Threaded.global_single_threaded.ioBasic();
14const io = std.Io.Threaded.global_single_threaded.io();
1515#expect_stdout="Hello, World!\n"
1616
1717#update=make function inline
......@@ -23,7 +23,7 @@ inline fn foo() !void {
2323 try std.Io.File.stdout().writeStreamingAll(io, "Hello, World!\n");
2424}
2525const std = @import("std");
26const io = std.Io.Threaded.global_single_threaded.ioBasic();
26const io = std.Io.Threaded.global_single_threaded.io();
2727#expect_stdout="Hello, World!\n"
2828
2929#update=change string
......@@ -35,5 +35,5 @@ inline fn foo() !void {
3535 try std.Io.File.stdout().writeStreamingAll(io, "Hello, `inline` World!\n");
3636}
3737const std = @import("std");
38const io = std.Io.Threaded.global_single_threaded.ioBasic();
38const io = std.Io.Threaded.global_single_threaded.io();
3939#expect_stdout="Hello, `inline` World!\n"
test/incremental/hello+2-2
......@@ -6,7 +6,7 @@
66#update=initial version
77#file=main.zig
88const std = @import("std");
9const io = std.Io.Threaded.global_single_threaded.ioBasic();
9const io = std.Io.Threaded.global_single_threaded.io();
1010pub fn main() !void {
1111 try std.Io.File.stdout().writeStreamingAll(io, "good morning\n");
1212}
......@@ -14,7 +14,7 @@ pub fn main() !void {
1414#update=change the string
1515#file=main.zig
1616const std = @import("std");
17const io = std.Io.Threaded.global_single_threaded.ioBasic();
17const io = std.Io.Threaded.global_single_threaded.io();
1818pub fn main() !void {
1919 try std.Io.File.stdout().writeStreamingAll(io, "おはようございます\n");
2020}
test/incremental/make_decl_pub+2-2
......@@ -14,7 +14,7 @@ const std = @import("std");
1414fn hello() !void {
1515 try std.Io.File.stdout().writeStreamingAll(io, "Hello, World!\n");
1616}
17const io = std.Io.Threaded.global_single_threaded.ioBasic();
17const io = std.Io.Threaded.global_single_threaded.io();
1818#expect_error=main.zig:3:12: error: 'hello' is not marked 'pub'
1919#expect_error=foo.zig:2:1: note: declared here
2020
......@@ -24,5 +24,5 @@ const std = @import("std");
2424pub fn hello() !void {
2525 try std.Io.File.stdout().writeStreamingAll(io, "Hello, World!\n");
2626}
27const io = std.Io.Threaded.global_single_threaded.ioBasic();
27const io = std.Io.Threaded.global_single_threaded.io();
2828#expect_stdout="Hello, World!\n"
test/incremental/modify_inline_fn+2-2
......@@ -13,7 +13,7 @@ pub fn main() !void {
1313inline fn getStr() []const u8 {
1414 return "foo\n";
1515}
16const io = std.Io.Threaded.global_single_threaded.ioBasic();
16const io = std.Io.Threaded.global_single_threaded.io();
1717#expect_stdout="foo\n"
1818#update=change the string
1919#file=main.zig
......@@ -25,5 +25,5 @@ pub fn main() !void {
2525inline fn getStr() []const u8 {
2626 return "bar\n";
2727}
28const io = std.Io.Threaded.global_single_threaded.ioBasic();
28const io = std.Io.Threaded.global_single_threaded.io();
2929#expect_stdout="bar\n"
test/incremental/move_src+2-2
......@@ -16,7 +16,7 @@ fn foo() u32 {
1616fn bar() u32 {
1717 return 123;
1818}
19const io = std.Io.Threaded.global_single_threaded.ioBasic();
19const io = std.Io.Threaded.global_single_threaded.io();
2020#expect_stdout="7 123\n"
2121
2222#update=add newline
......@@ -33,5 +33,5 @@ fn foo() u32 {
3333fn bar() u32 {
3434 return 123;
3535}
36const io = std.Io.Threaded.global_single_threaded.ioBasic();
36const io = std.Io.Threaded.global_single_threaded.io();
3737#expect_stdout="8 123\n"
test/incremental/no_change_preserves_tag_names+2-2
......@@ -7,7 +7,7 @@
77#file=main.zig
88const std = @import("std");
99var some_enum: enum { first, second } = .first;
10const io = std.Io.Threaded.global_single_threaded.ioBasic();
10const io = std.Io.Threaded.global_single_threaded.io();
1111pub fn main() !void {
1212 try std.Io.File.stdout().writeStreamingAll(io, @tagName(some_enum));
1313}
......@@ -16,7 +16,7 @@ pub fn main() !void {
1616#file=main.zig
1717const std = @import("std");
1818var some_enum: enum { first, second } = .first;
19const io = std.Io.Threaded.global_single_threaded.ioBasic();
19const io = std.Io.Threaded.global_single_threaded.io();
2020pub fn main() !void {
2121 try std.Io.File.stdout().writeStreamingAll(io, @tagName(some_enum));
2222}
test/incremental/recursive_function_becomes_non_recursive+2-2
......@@ -14,7 +14,7 @@ fn foo(recurse: bool) !void {
1414 try stdout.writeStreamingAll(io, "non-recursive path\n");
1515}
1616const std = @import("std");
17const io = std.Io.Threaded.global_single_threaded.ioBasic();
17const io = std.Io.Threaded.global_single_threaded.io();
1818#expect_stdout="non-recursive path\n"
1919
2020#update=eliminate recursion and change argument
......@@ -28,5 +28,5 @@ fn foo(recurse: bool) !void {
2828 try stdout.writeStreamingAll(io, "non-recursive path\n");
2929}
3030const std = @import("std");
31const io = std.Io.Threaded.global_single_threaded.ioBasic();
31const io = std.Io.Threaded.global_single_threaded.io();
3232#expect_stdout="x==1\n"
test/incremental/remove_enum_field+2-2
......@@ -14,7 +14,7 @@ pub fn main() !void {
1414 try stdout_writer.interface.print("{}\n", .{@intFromEnum(MyEnum.foo)});
1515}
1616const std = @import("std");
17const io = std.Io.Threaded.global_single_threaded.ioBasic();
17const io = std.Io.Threaded.global_single_threaded.io();
1818#expect_stdout="1\n"
1919#update=remove enum field
2020#file=main.zig
......@@ -27,6 +27,6 @@ pub fn main() !void {
2727 try stdout_writer.interface.print("{}\n", .{@intFromEnum(MyEnum.foo)});
2828}
2929const std = @import("std");
30const io = std.Io.Threaded.global_single_threaded.ioBasic();
30const io = std.Io.Threaded.global_single_threaded.io();
3131#expect_error=main.zig:7:69: error: enum 'main.MyEnum' has no member named 'foo'
3232#expect_error=main.zig:1:16: note: enum declared here
test/incremental/unreferenced_error+4-4
......@@ -10,7 +10,7 @@ pub fn main() !void {
1010 try std.Io.File.stdout().writeStreamingAll(io, a);
1111}
1212const a = "Hello, World!\n";
13const io = std.Io.Threaded.global_single_threaded.ioBasic();
13const io = std.Io.Threaded.global_single_threaded.io();
1414#expect_stdout="Hello, World!\n"
1515
1616#update=introduce compile error
......@@ -20,7 +20,7 @@ pub fn main() !void {
2020 try std.Io.File.stdout().writeStreamingAll(io, a);
2121}
2222const a = @compileError("bad a");
23const io = std.Io.Threaded.global_single_threaded.ioBasic();
23const io = std.Io.Threaded.global_single_threaded.io();
2424#expect_error=main.zig:5:11: error: bad a
2525
2626#update=remove error reference
......@@ -31,7 +31,7 @@ pub fn main() !void {
3131}
3232const a = @compileError("bad a");
3333const b = "Hi there!\n";
34const io = std.Io.Threaded.global_single_threaded.ioBasic();
34const io = std.Io.Threaded.global_single_threaded.io();
3535#expect_stdout="Hi there!\n"
3636
3737#update=introduce and remove reference to error
......@@ -42,5 +42,5 @@ pub fn main() !void {
4242}
4343const a = "Back to a\n";
4444const b = @compileError("bad b");
45const io = std.Io.Threaded.global_single_threaded.ioBasic();
45const io = std.Io.Threaded.global_single_threaded.io();
4646#expect_stdout="Back to a\n"
test/standalone/coff_dwarf/build.zig+3
......@@ -46,6 +46,9 @@ pub fn build(b: *std.Build) void {
4646 lib.root_module.addCSourceFile(.{ .file = b.path("shared_lib.c"), .flags = &.{"-gdwarf"} });
4747 exe.root_module.linkLibrary(lib);
4848
49 if (target.result.os.tag == .windows)
50 exe.root_module.linkSystemLibrary("ws2_32", .{});
51
4952 const run = b.addRunArtifact(exe);
5053 run.expectExitCode(0);
5154 run.skip_foreign_checks = true;
test/standalone/dirname/exists_in.zig+1-1
......@@ -26,7 +26,7 @@ pub fn main(init: std.process.Init) !void {
2626 return error.BadUsage;
2727 };
2828
29 const io = std.Io.Threaded.global_single_threaded.ioBasic();
29 const io = std.Io.Threaded.global_single_threaded.io();
3030
3131 var dir = try std.Io.Dir.cwd().openDir(io, dir_path, .{});
3232 defer dir.close(io);
test/standalone/dirname/touch.zig+1-1
......@@ -21,7 +21,7 @@ pub fn main(init: std.process.Init) !void {
2121 const dir_path = std.Io.Dir.path.dirname(path) orelse unreachable;
2222 const basename = std.Io.Dir.path.basename(path);
2323
24 const io = std.Io.Threaded.global_single_threaded.ioBasic();
24 const io = std.Io.Threaded.global_single_threaded.io();
2525
2626 var dir = try std.Io.Dir.cwd().openDir(io, dir_path, .{});
2727 defer dir.close(io);
test/standalone/issue_5825/build.zig+1
......@@ -34,6 +34,7 @@ pub fn build(b: *std.Build) void {
3434 exe.subsystem = .console;
3535 exe.root_module.linkSystemLibrary("kernel32", .{});
3636 exe.root_module.linkSystemLibrary("ntdll", .{});
37 exe.root_module.linkSystemLibrary("ws2_32", .{});
3738 exe.root_module.addObject(obj);
3839
3940 // TODO: actually check the output
test/standalone/mix_o_files/build.zig+3
......@@ -16,6 +16,9 @@ pub fn build(b: *std.Build) void {
1616 }),
1717 });
1818
19 if (target.result.os.tag == .windows)
20 obj.root_module.linkSystemLibrary("ws2_32", .{});
21
1922 const exe = b.addExecutable(.{
2023 .name = "test",
2124 .root_module = b.createModule(.{
test/standalone/run_cwd/check_file_exists.zig+1-1
......@@ -5,7 +5,7 @@ pub fn main(init: std.process.Init) !void {
55 if (args.len != 2) return error.BadUsage;
66 const path = args[1];
77
8 const io = std.Io.Threaded.global_single_threaded.ioBasic();
8 const io = std.Io.Threaded.global_single_threaded.io();
99
1010 std.Io.Dir.cwd().access(io, path, .{}) catch return error.AccessFailed;
1111}
test/standalone/shared_library/build.zig+4-1
......@@ -5,7 +5,7 @@ pub fn build(b: *std.Build) void {
55 b.default_step = test_step;
66
77 const optimize: std.builtin.OptimizeMode = .Debug;
8 const target = b.graph.host;
8 const target = b.standardTargetOptions(.{});
99
1010 const exe_names: []const []const u8 = &.{ "test", "test-dync" };
1111 const lib_names: []const []const u8 = &.{ "mathtest", "mathtest-dync" };
......@@ -24,6 +24,9 @@ pub fn build(b: *std.Build) void {
2424 }),
2525 });
2626
27 if (target.result.os.tag == .windows)
28 lib.root_module.linkSystemLibrary("ws2_32", .{});
29
2730 const exe = b.addExecutable(.{
2831 .name = exe_name,
2932 .root_module = b.createModule(.{
test/standalone/windows_argv/build.zig+3
......@@ -20,6 +20,8 @@ pub fn build(b: *std.Build) !void {
2020 .optimize = optimize,
2121 }),
2222 });
23 lib_gnu.root_module.linkSystemLibrary("ws2_32", .{});
24
2325 const verify_gnu = b.addExecutable(.{
2426 .name = "verify-gnu",
2527 .root_module = b.createModule(.{
......@@ -101,6 +103,7 @@ pub fn build(b: *std.Build) !void {
101103 .flags = &.{ "-DUNICODE", "-D_UNICODE" },
102104 });
103105 verify_msvc.root_module.linkLibrary(lib_msvc);
106 verify_msvc.root_module.linkSystemLibrary("ws2_32", .{});
104107 verify_msvc.root_module.link_libc = true;
105108
106109 const run_msvc = b.addRunArtifact(fuzz);