authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-12-06 17:32:19-08:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-12-23 22:15:08-08:00
logdd1d15b72aa3bae4b38e2337609758ffb7a7b55a
treee6e43ed851e9a0107e851df242c23b66855151d3
parent3204fb756980c19b7a95534acdd7a1bba837fbc3

update all occurrences of std.fs.Dir to std.Io.Dir


24 files changed, 81 insertions(+), 78 deletions(-)

lib/compiler/aro/aro/Compilation.zig+3-3
...@@ -154,7 +154,7 @@ gpa: Allocator,...@@ -154,7 +154,7 @@ gpa: Allocator,
154/// Allocations in this arena live all the way until `Compilation.deinit`.154/// Allocations in this arena live all the way until `Compilation.deinit`.
155arena: Allocator,155arena: Allocator,
156io: Io,156io: Io,
157cwd: std.fs.Dir,157cwd: Io.Dir,
158diagnostics: *Diagnostics,158diagnostics: *Diagnostics,
159159
160sources: std.StringArrayHashMapUnmanaged(Source) = .empty,160sources: std.StringArrayHashMapUnmanaged(Source) = .empty,
...@@ -181,7 +181,7 @@ pragma_handlers: std.StringArrayHashMapUnmanaged(*Pragma) = .empty,...@@ -181,7 +181,7 @@ pragma_handlers: std.StringArrayHashMapUnmanaged(*Pragma) = .empty,
181/// Used by MS extensions which allow searching for includes relative to the directory of the main source file.181/// Used by MS extensions which allow searching for includes relative to the directory of the main source file.
182ms_cwd_source_id: ?Source.Id = null,182ms_cwd_source_id: ?Source.Id = null,
183183
184pub fn init(gpa: Allocator, arena: Allocator, io: Io, diagnostics: *Diagnostics, cwd: std.fs.Dir) Compilation {184pub fn init(gpa: Allocator, arena: Allocator, io: Io, diagnostics: *Diagnostics, cwd: Io.Dir) Compilation {
185 return .{185 return .{
186 .gpa = gpa,186 .gpa = gpa,
187 .arena = arena,187 .arena = arena,
...@@ -193,7 +193,7 @@ pub fn init(gpa: Allocator, arena: Allocator, io: Io, diagnostics: *Diagnostics,...@@ -193,7 +193,7 @@ pub fn init(gpa: Allocator, arena: Allocator, io: Io, diagnostics: *Diagnostics,
193193
194/// Initialize Compilation with default environment,194/// Initialize Compilation with default environment,
195/// pragma handlers and emulation mode set to target.195/// pragma handlers and emulation mode set to target.
196pub fn initDefault(gpa: Allocator, arena: Allocator, io: Io, diagnostics: *Diagnostics, cwd: std.fs.Dir) !Compilation {196pub fn initDefault(gpa: Allocator, arena: Allocator, io: Io, diagnostics: *Diagnostics, cwd: Io.Dir) !Compilation {
197 var comp: Compilation = .{197 var comp: Compilation = .{
198 .gpa = gpa,198 .gpa = gpa,
199 .arena = arena,199 .arena = arena,
lib/compiler/resinator/cli.zig+1-1
...@@ -250,7 +250,7 @@ pub const Options = struct {...@@ -250,7 +250,7 @@ pub const Options = struct {
250 /// worlds' situation where we'll be compatible with most use-cases250 /// worlds' situation where we'll be compatible with most use-cases
251 /// of the .rc extension being omitted from the CLI args, but still251 /// of the .rc extension being omitted from the CLI args, but still
252 /// work fine if the file itself does not have an extension.252 /// work fine if the file itself does not have an extension.
253 pub fn maybeAppendRC(options: *Options, cwd: std.fs.Dir) !void {253 pub fn maybeAppendRC(options: *Options, cwd: Io.Dir) !void {
254 switch (options.input_source) {254 switch (options.input_source) {
255 .stdio => return,255 .stdio => return,
256 .filename => {},256 .filename => {},
lib/compiler/resinator/errors.zig+3-3
...@@ -67,7 +67,7 @@ pub const Diagnostics = struct {...@@ -67,7 +67,7 @@ pub const Diagnostics = struct {
67 return @intCast(index);67 return @intCast(index);
68 }68 }
6969
70 pub fn renderToStdErr(self: *Diagnostics, cwd: std.fs.Dir, source: []const u8, source_mappings: ?SourceMappings) void {70 pub fn renderToStdErr(self: *Diagnostics, cwd: Io.Dir, source: []const u8, source_mappings: ?SourceMappings) void {
71 const io = self.io;71 const io = self.io;
72 const stderr, const ttyconf = std.debug.lockStderrWriter(&.{});72 const stderr, const ttyconf = std.debug.lockStderrWriter(&.{});
73 defer std.debug.unlockStderrWriter();73 defer std.debug.unlockStderrWriter();
...@@ -903,7 +903,7 @@ pub fn renderErrorMessage(...@@ -903,7 +903,7 @@ pub fn renderErrorMessage(
903 io: Io,903 io: Io,
904 writer: *std.Io.Writer,904 writer: *std.Io.Writer,
905 tty_config: std.Io.tty.Config,905 tty_config: std.Io.tty.Config,
906 cwd: std.fs.Dir,906 cwd: Io.Dir,
907 err_details: ErrorDetails,907 err_details: ErrorDetails,
908 source: []const u8,908 source: []const u8,
909 strings: []const []const u8,909 strings: []const []const u8,
...@@ -1100,7 +1100,7 @@ const CorrespondingLines = struct {...@@ -1100,7 +1100,7 @@ const CorrespondingLines = struct {
11001100
1101 pub fn init(1101 pub fn init(
1102 io: Io,1102 io: Io,
1103 cwd: std.fs.Dir,1103 cwd: Io.Dir,
1104 err_details: ErrorDetails,1104 err_details: ErrorDetails,
1105 line_for_comparison: []const u8,1105 line_for_comparison: []const u8,
1106 corresponding_span: SourceMappings.CorrespondingSpan,1106 corresponding_span: SourceMappings.CorrespondingSpan,
lib/compiler/resinator/main.zig+1-1
...@@ -707,7 +707,7 @@ const ErrorHandler = union(enum) {...@@ -707,7 +707,7 @@ const ErrorHandler = union(enum) {
707 pub fn emitDiagnostics(707 pub fn emitDiagnostics(
708 self: *ErrorHandler,708 self: *ErrorHandler,
709 allocator: Allocator,709 allocator: Allocator,
710 cwd: std.fs.Dir,710 cwd: Io.Dir,
711 source: []const u8,711 source: []const u8,
712 diagnostics: *Diagnostics,712 diagnostics: *Diagnostics,
713 mappings: SourceMappings,713 mappings: SourceMappings,
lib/compiler/resinator/utils.zig+2-2
...@@ -25,11 +25,11 @@ pub const UncheckedSliceWriter = struct {...@@ -25,11 +25,11 @@ pub const UncheckedSliceWriter = struct {
25 }25 }
26};26};
2727
28/// Cross-platform 'std.fs.Dir.openFile' wrapper that will always return IsDir if28/// Cross-platform 'Io.Dir.openFile' wrapper that will always return IsDir if
29/// a directory is attempted to be opened.29/// a directory is attempted to be opened.
30/// TODO: Remove once https://github.com/ziglang/zig/issues/5732 is addressed.30/// TODO: Remove once https://github.com/ziglang/zig/issues/5732 is addressed.
31pub fn openFileNotDir(31pub fn openFileNotDir(
32 cwd: std.fs.Dir,32 cwd: Io.Dir,
33 io: Io,33 io: Io,
34 path: []const u8,34 path: []const u8,
35 flags: Io.File.OpenFlags,35 flags: Io.File.OpenFlags,
lib/compiler/std-docs.zig+1-1
...@@ -133,7 +133,7 @@ fn accept(context: *Context, connection: std.net.Server.Connection) void {...@@ -133,7 +133,7 @@ fn accept(context: *Context, connection: std.net.Server.Connection) void {
133const Context = struct {133const Context = struct {
134 gpa: Allocator,134 gpa: Allocator,
135 io: Io,135 io: Io,
136 lib_dir: std.fs.Dir,136 lib_dir: Io.Dir,
137 zig_lib_directory: []const u8,137 zig_lib_directory: []const u8,
138 zig_exe_path: []const u8,138 zig_exe_path: []const u8,
139 global_cache_path: []const u8,139 global_cache_path: []const u8,
lib/std/Build.zig+1-1
...@@ -1699,7 +1699,7 @@ pub fn addCheckFile(...@@ -1699,7 +1699,7 @@ pub fn addCheckFile(
1699 return Step.CheckFile.create(b, file_source, options);1699 return Step.CheckFile.create(b, file_source, options);
1700}1700}
17011701
1702pub fn truncateFile(b: *Build, dest_path: []const u8) (fs.Dir.MakeError || fs.Dir.StatFileError)!void {1702pub fn truncateFile(b: *Build, dest_path: []const u8) (Io.Dir.MakeError || Io.Dir.StatFileError)!void {
1703 const io = b.graph.io;1703 const io = b.graph.io;
1704 if (b.verbose) log.info("truncate {s}", .{dest_path});1704 if (b.verbose) log.info("truncate {s}", .{dest_path});
1705 const cwd = fs.cwd();1705 const cwd = fs.cwd();
lib/std/Build/Step.zig+3-3
...@@ -505,7 +505,7 @@ pub fn evalZigProcess(...@@ -505,7 +505,7 @@ pub fn evalZigProcess(
505 return result;505 return result;
506}506}
507507
508/// Wrapper around `std.fs.Dir.updateFile` that handles verbose and error output.508/// Wrapper around `Io.Dir.updateFile` that handles verbose and error output.
509pub fn installFile(s: *Step, src_lazy_path: Build.LazyPath, dest_path: []const u8) !Io.Dir.PrevStatus {509pub fn installFile(s: *Step, src_lazy_path: Build.LazyPath, dest_path: []const u8) !Io.Dir.PrevStatus {
510 const b = s.owner;510 const b = s.owner;
511 const io = b.graph.io;511 const io = b.graph.io;
...@@ -515,8 +515,8 @@ pub fn installFile(s: *Step, src_lazy_path: Build.LazyPath, dest_path: []const u...@@ -515,8 +515,8 @@ pub fn installFile(s: *Step, src_lazy_path: Build.LazyPath, dest_path: []const u
515 return s.fail("unable to update file from '{f}' to '{s}': {t}", .{ src_path, dest_path, err });515 return s.fail("unable to update file from '{f}' to '{s}': {t}", .{ src_path, dest_path, err });
516}516}
517517
518/// Wrapper around `std.fs.Dir.makePathStatus` that handles verbose and error output.518/// Wrapper around `Io.Dir.makePathStatus` that handles verbose and error output.
519pub fn installDir(s: *Step, dest_path: []const u8) !std.fs.Dir.MakePathStatus {519pub fn installDir(s: *Step, dest_path: []const u8) !Io.Dir.MakePathStatus {
520 const b = s.owner;520 const b = s.owner;
521 try handleVerbose(b, null, &.{ "install", "-d", dest_path });521 try handleVerbose(b, null, &.{ "install", "-d", dest_path });
522 return std.fs.cwd().makePathStatus(dest_path) catch |err|522 return std.fs.cwd().makePathStatus(dest_path) catch |err|
lib/std/Build/Watch.zig+1-1
...@@ -350,7 +350,7 @@ const Os = switch (builtin.os.tag) {...@@ -350,7 +350,7 @@ const Os = switch (builtin.os.tag) {
350 }350 }
351351
352 fn init(gpa: Allocator, path: Cache.Path) !*@This() {352 fn init(gpa: Allocator, path: Cache.Path) !*@This() {
353 // The following code is a drawn out NtCreateFile call. (mostly adapted from std.fs.Dir.makeOpenDirAccessMaskW)353 // The following code is a drawn out NtCreateFile call. (mostly adapted from Io.Dir.makeOpenDirAccessMaskW)
354 // It's necessary in order to get the specific flags that are required when calling ReadDirectoryChangesW.354 // It's necessary in order to get the specific flags that are required when calling ReadDirectoryChangesW.
355 var dir_handle: windows.HANDLE = undefined;355 var dir_handle: windows.HANDLE = undefined;
356 const root_fd = path.root_dir.handle.fd;356 const root_fd = path.root_dir.handle.fd;
lib/std/Io/Dir.zig+1-1
...@@ -481,7 +481,7 @@ pub fn updateFile(...@@ -481,7 +481,7 @@ pub fn updateFile(
481 }481 }
482482
483 var buffer: [1000]u8 = undefined; // Used only when direct fd-to-fd is not available.483 var buffer: [1000]u8 = undefined; // Used only when direct fd-to-fd is not available.
484 var atomic_file = try std.fs.Dir.atomicFile(.adaptFromNewApi(dest_dir), dest_path, .{484 var atomic_file = try Dir.atomicFile(.adaptFromNewApi(dest_dir), dest_path, .{
485 .permissions = actual_permissions,485 .permissions = actual_permissions,
486 .write_buffer = &buffer,486 .write_buffer = &buffer,
487 });487 });
lib/std/crypto/Certificate/Bundle.zig+2-2
...@@ -177,7 +177,7 @@ pub fn addCertsFromDirPath(...@@ -177,7 +177,7 @@ pub fn addCertsFromDirPath(
177 cb: *Bundle,177 cb: *Bundle,
178 gpa: Allocator,178 gpa: Allocator,
179 io: Io,179 io: Io,
180 dir: fs.Dir,180 dir: Io.Dir,
181 sub_dir_path: []const u8,181 sub_dir_path: []const u8,
182) AddCertsFromDirPathError!void {182) AddCertsFromDirPathError!void {
183 var iterable_dir = try dir.openDir(sub_dir_path, .{ .iterate = true });183 var iterable_dir = try dir.openDir(sub_dir_path, .{ .iterate = true });
...@@ -200,7 +200,7 @@ pub fn addCertsFromDirPathAbsolute(...@@ -200,7 +200,7 @@ pub fn addCertsFromDirPathAbsolute(
200200
201pub const AddCertsFromDirError = AddCertsFromFilePathError;201pub const AddCertsFromDirError = AddCertsFromFilePathError;
202202
203pub fn addCertsFromDir(cb: *Bundle, gpa: Allocator, io: Io, now: Io.Timestamp, iterable_dir: fs.Dir) AddCertsFromDirError!void {203pub fn addCertsFromDir(cb: *Bundle, gpa: Allocator, io: Io, now: Io.Timestamp, iterable_dir: Io.Dir) AddCertsFromDirError!void {
204 var it = iterable_dir.iterate();204 var it = iterable_dir.iterate();
205 while (try it.next()) |entry| {205 while (try it.next()) |entry| {
206 switch (entry.kind) {206 switch (entry.kind) {
lib/std/dynamic_library.zig+1-1
...@@ -157,7 +157,7 @@ pub const ElfDynLib = struct {...@@ -157,7 +157,7 @@ pub const ElfDynLib = struct {
157 dt_gnu_hash: *elf.gnu_hash.Header,157 dt_gnu_hash: *elf.gnu_hash.Header,
158 };158 };
159159
160 fn openPath(path: []const u8, io: Io) !std.fs.Dir {160 fn openPath(path: []const u8, io: Io) !Io.Dir {
161 if (path.len == 0) return error.NotDir;161 if (path.len == 0) return error.NotDir;
162 var parts = std.mem.tokenizeScalar(u8, path, '/');162 var parts = std.mem.tokenizeScalar(u8, path, '/');
163 var parent = if (path[0] == '/') try std.fs.cwd().openDir("/", .{}) else std.fs.cwd();163 var parent = if (path[0] == '/') try std.fs.cwd().openDir("/", .{}) else std.fs.cwd();
lib/std/fs/path.zig+2-2
...@@ -872,7 +872,7 @@ pub fn resolve(allocator: Allocator, paths: []const []const u8) Allocator.Error!...@@ -872,7 +872,7 @@ pub fn resolve(allocator: Allocator, paths: []const []const u8) Allocator.Error!
872872
873/// This function is like a series of `cd` statements executed one after another.873/// This function is like a series of `cd` statements executed one after another.
874/// It resolves "." and ".." to the best of its ability, but will not convert relative paths to874/// It resolves "." and ".." to the best of its ability, but will not convert relative paths to
875/// an absolute path, use std.fs.Dir.realpath instead.875/// an absolute path, use Io.Dir.realpath instead.
876/// ".." components may persist in the resolved path if the resolved path is relative or drive-relative.876/// ".." components may persist in the resolved path if the resolved path is relative or drive-relative.
877/// Path separators are canonicalized to '\\' and drives are canonicalized to capital letters.877/// Path separators are canonicalized to '\\' and drives are canonicalized to capital letters.
878///878///
...@@ -1095,7 +1095,7 @@ pub fn resolveWindows(allocator: Allocator, paths: []const []const u8) Allocator...@@ -1095,7 +1095,7 @@ pub fn resolveWindows(allocator: Allocator, paths: []const []const u8) Allocator
10951095
1096/// This function is like a series of `cd` statements executed one after another.1096/// This function is like a series of `cd` statements executed one after another.
1097/// It resolves "." and ".." to the best of its ability, but will not convert relative paths to1097/// It resolves "." and ".." to the best of its ability, but will not convert relative paths to
1098/// an absolute path, use std.fs.Dir.realpath instead.1098/// an absolute path, use Io.Dir.realpath instead.
1099/// ".." components may persist in the resolved path if the resolved path is relative.1099/// ".." components may persist in the resolved path if the resolved path is relative.
1100/// The result does not have a trailing path separator.1100/// The result does not have a trailing path separator.
1101/// This function does not perform any syscalls. Executing this series of path1101/// This function does not perform any syscalls. Executing this series of path
lib/std/fs/test.zig+6-7
...@@ -9,12 +9,11 @@ const mem = std.mem;...@@ -9,12 +9,11 @@ const mem = std.mem;
9const wasi = std.os.wasi;9const wasi = std.os.wasi;
10const windows = std.os.windows;10const windows = std.os.windows;
11const posix = std.posix;11const posix = std.posix;
12
13const ArenaAllocator = std.heap.ArenaAllocator;12const ArenaAllocator = std.heap.ArenaAllocator;
14const Dir = std.fs.Dir;13const Dir = std.Io.Dir;
15const File = std.Io.File;14const File = std.Io.File;
16const tmpDir = testing.tmpDir;15const tmpDir = std.testing.tmpDir;
17const SymLinkFlags = std.fs.Dir.SymLinkFlags;16const SymLinkFlags = std.Io.Dir.SymLinkFlags;
1817
19const PathType = enum {18const PathType = enum {
20 relative,19 relative,
...@@ -80,7 +79,7 @@ const TestContext = struct {...@@ -80,7 +79,7 @@ const TestContext = struct {
80 path_sep: u8,79 path_sep: u8,
81 arena: ArenaAllocator,80 arena: ArenaAllocator,
82 tmp: testing.TmpDir,81 tmp: testing.TmpDir,
83 dir: std.fs.Dir,82 dir: Io.Dir,
84 transform_fn: *const PathType.TransformFn,83 transform_fn: *const PathType.TransformFn,
8584
86 pub fn init(path_type: PathType, path_sep: u8, allocator: mem.Allocator, transform_fn: *const PathType.TransformFn) TestContext {85 pub fn init(path_type: PathType, path_sep: u8, allocator: mem.Allocator, transform_fn: *const PathType.TransformFn) TestContext {
...@@ -1772,7 +1771,7 @@ test "open file with exclusive lock twice, make sure second lock waits" {...@@ -1772,7 +1771,7 @@ test "open file with exclusive lock twice, make sure second lock waits" {
1772 errdefer file.close(io);1771 errdefer file.close(io);
17731772
1774 const S = struct {1773 const S = struct {
1775 fn checkFn(dir: *fs.Dir, path: []const u8, started: *std.Thread.ResetEvent, locked: *std.Thread.ResetEvent) !void {1774 fn checkFn(dir: *Io.Dir, path: []const u8, started: *std.Thread.ResetEvent, locked: *std.Thread.ResetEvent) !void {
1776 started.set();1775 started.set();
1777 const file1 = try dir.createFile(path, .{ .lock = .exclusive });1776 const file1 = try dir.createFile(path, .{ .lock = .exclusive });
17781777
...@@ -2016,7 +2015,7 @@ test "walker without fully iterating" {...@@ -2016,7 +2015,7 @@ test "walker without fully iterating" {
2016 try testing.expectEqual(@as(usize, 1), num_walked);2015 try testing.expectEqual(@as(usize, 1), num_walked);
2017}2016}
20182017
2019test "'.' and '..' in fs.Dir functions" {2018test "'.' and '..' in Io.Dir functions" {
2020 if (native_os == .windows and builtin.cpu.arch == .aarch64) {2019 if (native_os == .windows and builtin.cpu.arch == .aarch64) {
2021 // https://github.com/ziglang/zig/issues/171342020 // https://github.com/ziglang/zig/issues/17134
2022 return error.SkipZigTest;2021 return error.SkipZigTest;
lib/std/process/Child.zig+2-2
...@@ -77,7 +77,7 @@ cwd: ?[]const u8,...@@ -77,7 +77,7 @@ cwd: ?[]const u8,
77/// Set to change the current working directory when spawning the child process.77/// Set to change the current working directory when spawning the child process.
78/// This is not yet implemented for Windows. See https://github.com/ziglang/zig/issues/519078/// This is not yet implemented for Windows. See https://github.com/ziglang/zig/issues/5190
79/// Once that is done, `cwd` will be deprecated in favor of this field.79/// Once that is done, `cwd` will be deprecated in favor of this field.
80cwd_dir: ?fs.Dir = null,80cwd_dir: ?Io.Dir = null,
8181
82err_pipe: if (native_os == .windows) void else ?posix.fd_t,82err_pipe: if (native_os == .windows) void else ?posix.fd_t,
8383
...@@ -439,7 +439,7 @@ pub fn run(args: struct {...@@ -439,7 +439,7 @@ pub fn run(args: struct {
439 allocator: mem.Allocator,439 allocator: mem.Allocator,
440 argv: []const []const u8,440 argv: []const []const u8,
441 cwd: ?[]const u8 = null,441 cwd: ?[]const u8 = null,
442 cwd_dir: ?fs.Dir = null,442 cwd_dir: ?Io.Dir = null,
443 /// Required if unable to access the current env map (e.g. building a443 /// Required if unable to access the current env map (e.g. building a
444 /// library on some platforms).444 /// library on some platforms).
445 env_map: ?*const EnvMap = null,445 env_map: ?*const EnvMap = null,
lib/std/testing.zig+31-29
...@@ -1,5 +1,7 @@...@@ -1,5 +1,7 @@
1const std = @import("std.zig");
2const builtin = @import("builtin");1const builtin = @import("builtin");
2
3const std = @import("std.zig");
4const Io = std.Io;
3const assert = std.debug.assert;5const assert = std.debug.assert;
4const math = std.math;6const math = std.math;
57
...@@ -28,7 +30,7 @@ pub var allocator_instance: std.heap.GeneralPurposeAllocator(.{...@@ -28,7 +30,7 @@ pub var allocator_instance: std.heap.GeneralPurposeAllocator(.{
28 break :b .init;30 break :b .init;
29};31};
3032
31pub var io_instance: std.Io.Threaded = undefined;33pub var io_instance: Io.Threaded = undefined;
32pub const io = io_instance.io();34pub const io = io_instance.io();
3335
34/// TODO https://github.com/ziglang/zig/issues/573836/// TODO https://github.com/ziglang/zig/issues/5738
...@@ -355,7 +357,7 @@ test expectApproxEqRel {...@@ -355,7 +357,7 @@ test expectApproxEqRel {
355/// This function is intended to be used only in tests. When the two slices are not357/// This function is intended to be used only in tests. When the two slices are not
356/// equal, prints diagnostics to stderr to show exactly how they are not equal (with358/// equal, prints diagnostics to stderr to show exactly how they are not equal (with
357/// the differences highlighted in red), then returns a test failure error.359/// the differences highlighted in red), then returns a test failure error.
358/// The colorized output is optional and controlled by the return of `std.Io.tty.Config.detect`.360/// The colorized output is optional and controlled by the return of `Io.tty.Config.detect`.
359/// If your inputs are UTF-8 encoded strings, consider calling `expectEqualStrings` instead.361/// If your inputs are UTF-8 encoded strings, consider calling `expectEqualStrings` instead.
360pub fn expectEqualSlices(comptime T: type, expected: []const T, actual: []const T) !void {362pub fn expectEqualSlices(comptime T: type, expected: []const T, actual: []const T) !void {
361 const diff_index: usize = diff_index: {363 const diff_index: usize = diff_index: {
...@@ -378,8 +380,8 @@ fn failEqualSlices(...@@ -378,8 +380,8 @@ fn failEqualSlices(
378 expected: []const T,380 expected: []const T,
379 actual: []const T,381 actual: []const T,
380 diff_index: usize,382 diff_index: usize,
381 w: *std.Io.Writer,383 w: *Io.Writer,
382 ttyconf: std.Io.tty.Config,384 ttyconf: Io.tty.Config,
383) !void {385) !void {
384 try w.print("slices differ. first difference occurs at index {d} (0x{X})\n", .{ diff_index, diff_index });386 try w.print("slices differ. first difference occurs at index {d} (0x{X})\n", .{ diff_index, diff_index });
385387
...@@ -464,11 +466,11 @@ fn SliceDiffer(comptime T: type) type {...@@ -464,11 +466,11 @@ fn SliceDiffer(comptime T: type) type {
464 start_index: usize,466 start_index: usize,
465 expected: []const T,467 expected: []const T,
466 actual: []const T,468 actual: []const T,
467 ttyconf: std.Io.tty.Config,469 ttyconf: Io.tty.Config,
468470
469 const Self = @This();471 const Self = @This();
470472
471 pub fn write(self: Self, writer: *std.Io.Writer) !void {473 pub fn write(self: Self, writer: *Io.Writer) !void {
472 for (self.expected, 0..) |value, i| {474 for (self.expected, 0..) |value, i| {
473 const full_index = self.start_index + i;475 const full_index = self.start_index + i;
474 const diff = if (i < self.actual.len) !std.meta.eql(self.actual[i], value) else true;476 const diff = if (i < self.actual.len) !std.meta.eql(self.actual[i], value) else true;
...@@ -487,9 +489,9 @@ fn SliceDiffer(comptime T: type) type {...@@ -487,9 +489,9 @@ fn SliceDiffer(comptime T: type) type {
487const BytesDiffer = struct {489const BytesDiffer = struct {
488 expected: []const u8,490 expected: []const u8,
489 actual: []const u8,491 actual: []const u8,
490 ttyconf: std.Io.tty.Config,492 ttyconf: Io.tty.Config,
491493
492 pub fn write(self: BytesDiffer, writer: *std.Io.Writer) !void {494 pub fn write(self: BytesDiffer, writer: *Io.Writer) !void {
493 var expected_iterator = std.mem.window(u8, self.expected, 16, 16);495 var expected_iterator = std.mem.window(u8, self.expected, 16, 16);
494 var row: usize = 0;496 var row: usize = 0;
495 while (expected_iterator.next()) |chunk| {497 while (expected_iterator.next()) |chunk| {
...@@ -535,7 +537,7 @@ const BytesDiffer = struct {...@@ -535,7 +537,7 @@ const BytesDiffer = struct {
535 }537 }
536 }538 }
537539
538 fn writeDiff(self: BytesDiffer, writer: *std.Io.Writer, comptime fmt: []const u8, args: anytype, diff: bool) !void {540 fn writeDiff(self: BytesDiffer, writer: *Io.Writer, comptime fmt: []const u8, args: anytype, diff: bool) !void {
539 if (diff) try self.ttyconf.setColor(writer, .red);541 if (diff) try self.ttyconf.setColor(writer, .red);
540 try writer.print(fmt, args);542 try writer.print(fmt, args);
541 if (diff) try self.ttyconf.setColor(writer, .reset);543 if (diff) try self.ttyconf.setColor(writer, .reset);
...@@ -605,8 +607,8 @@ pub fn expect(ok: bool) !void {...@@ -605,8 +607,8 @@ pub fn expect(ok: bool) !void {
605}607}
606608
607pub const TmpDir = struct {609pub const TmpDir = struct {
608 dir: std.fs.Dir,610 dir: Io.Dir,
609 parent_dir: std.fs.Dir,611 parent_dir: Io.Dir,
610 sub_path: [sub_path_len]u8,612 sub_path: [sub_path_len]u8,
611613
612 const random_bytes_count = 12;614 const random_bytes_count = 12;
...@@ -620,7 +622,7 @@ pub const TmpDir = struct {...@@ -620,7 +622,7 @@ pub const TmpDir = struct {
620 }622 }
621};623};
622624
623pub fn tmpDir(opts: std.fs.Dir.OpenOptions) TmpDir {625pub fn tmpDir(opts: Io.Dir.OpenOptions) TmpDir {
624 var random_bytes: [TmpDir.random_bytes_count]u8 = undefined;626 var random_bytes: [TmpDir.random_bytes_count]u8 = undefined;
625 std.crypto.random.bytes(&random_bytes);627 std.crypto.random.bytes(&random_bytes);
626 var sub_path: [TmpDir.sub_path_len]u8 = undefined;628 var sub_path: [TmpDir.sub_path_len]u8 = undefined;
...@@ -929,7 +931,7 @@ test "expectEqualDeep primitive type" {...@@ -929,7 +931,7 @@ test "expectEqualDeep primitive type" {
929 a,931 a,
930 b,932 b,
931933
932 pub fn format(self: @This(), writer: *std.Io.Writer) !void {934 pub fn format(self: @This(), writer: *Io.Writer) !void {
933 try writer.writeAll(@tagName(self));935 try writer.writeAll(@tagName(self));
934 }936 }
935 };937 };
...@@ -1160,7 +1162,7 @@ pub fn checkAllAllocationFailures(backing_allocator: std.mem.Allocator, comptime...@@ -1160,7 +1162,7 @@ pub fn checkAllAllocationFailures(backing_allocator: std.mem.Allocator, comptime
1160 } else |err| switch (err) {1162 } else |err| switch (err) {
1161 error.OutOfMemory => {1163 error.OutOfMemory => {
1162 if (failing_allocator_inst.allocated_bytes != failing_allocator_inst.freed_bytes) {1164 if (failing_allocator_inst.allocated_bytes != failing_allocator_inst.freed_bytes) {
1163 const tty_config: std.Io.tty.Config = .detect(.stderr());1165 const tty_config: Io.tty.Config = .detect(.stderr());
1164 print(1166 print(
1165 "\nfail_index: {d}/{d}\nallocated bytes: {d}\nfreed bytes: {d}\nallocations: {d}\ndeallocations: {d}\nallocation that was made to fail: {f}",1167 "\nfail_index: {d}/{d}\nallocated bytes: {d}\nfreed bytes: {d}\nallocations: {d}\ndeallocations: {d}\nallocation that was made to fail: {f}",
1166 .{1168 .{
...@@ -1220,14 +1222,14 @@ pub inline fn fuzz(...@@ -1220,14 +1222,14 @@ pub inline fn fuzz(
1220 return @import("root").fuzz(context, testOne, options);1222 return @import("root").fuzz(context, testOne, options);
1221}1223}
12221224
1223/// A `std.Io.Reader` that writes a predetermined list of buffers during `stream`.1225/// A `Io.Reader` that writes a predetermined list of buffers during `stream`.
1224pub const Reader = struct {1226pub const Reader = struct {
1225 calls: []const Call,1227 calls: []const Call,
1226 interface: std.Io.Reader,1228 interface: Io.Reader,
1227 next_call_index: usize,1229 next_call_index: usize,
1228 next_offset: usize,1230 next_offset: usize,
1229 /// Further reduces how many bytes are written in each `stream` call.1231 /// Further reduces how many bytes are written in each `stream` call.
1230 artificial_limit: std.Io.Limit = .unlimited,1232 artificial_limit: Io.Limit = .unlimited,
12311233
1232 pub const Call = struct {1234 pub const Call = struct {
1233 buffer: []const u8,1235 buffer: []const u8,
...@@ -1247,7 +1249,7 @@ pub const Reader = struct {...@@ -1247,7 +1249,7 @@ pub const Reader = struct {
1247 };1249 };
1248 }1250 }
12491251
1250 fn stream(io_r: *std.Io.Reader, w: *std.Io.Writer, limit: std.Io.Limit) std.Io.Reader.StreamError!usize {1252 fn stream(io_r: *Io.Reader, w: *Io.Writer, limit: Io.Limit) Io.Reader.StreamError!usize {
1251 const r: *Reader = @alignCast(@fieldParentPtr("interface", io_r));1253 const r: *Reader = @alignCast(@fieldParentPtr("interface", io_r));
1252 if (r.calls.len - r.next_call_index == 0) return error.EndOfStream;1254 if (r.calls.len - r.next_call_index == 0) return error.EndOfStream;
1253 const call = r.calls[r.next_call_index];1255 const call = r.calls[r.next_call_index];
...@@ -1262,13 +1264,13 @@ pub const Reader = struct {...@@ -1262,13 +1264,13 @@ pub const Reader = struct {
1262 }1264 }
1263};1265};
12641266
1265/// A `std.Io.Reader` that gets its data from another `std.Io.Reader`, and always1267/// A `Io.Reader` that gets its data from another `Io.Reader`, and always
1266/// writes to its own buffer (and returns 0) during `stream` and `readVec`.1268/// writes to its own buffer (and returns 0) during `stream` and `readVec`.
1267pub const ReaderIndirect = struct {1269pub const ReaderIndirect = struct {
1268 in: *std.Io.Reader,1270 in: *Io.Reader,
1269 interface: std.Io.Reader,1271 interface: Io.Reader,
12701272
1271 pub fn init(in: *std.Io.Reader, buffer: []u8) ReaderIndirect {1273 pub fn init(in: *Io.Reader, buffer: []u8) ReaderIndirect {
1272 return .{1274 return .{
1273 .in = in,1275 .in = in,
1274 .interface = .{1276 .interface = .{
...@@ -1283,17 +1285,17 @@ pub const ReaderIndirect = struct {...@@ -1283,17 +1285,17 @@ pub const ReaderIndirect = struct {
1283 };1285 };
1284 }1286 }
12851287
1286 fn readVec(r: *std.Io.Reader, _: [][]u8) std.Io.Reader.Error!usize {1288 fn readVec(r: *Io.Reader, _: [][]u8) Io.Reader.Error!usize {
1287 try streamInner(r);1289 try streamInner(r);
1288 return 0;1290 return 0;
1289 }1291 }
12901292
1291 fn stream(r: *std.Io.Reader, _: *std.Io.Writer, _: std.Io.Limit) std.Io.Reader.StreamError!usize {1293 fn stream(r: *Io.Reader, _: *Io.Writer, _: Io.Limit) Io.Reader.StreamError!usize {
1292 try streamInner(r);1294 try streamInner(r);
1293 return 0;1295 return 0;
1294 }1296 }
12951297
1296 fn streamInner(r: *std.Io.Reader) std.Io.Reader.Error!void {1298 fn streamInner(r: *Io.Reader) Io.Reader.Error!void {
1297 const r_indirect: *ReaderIndirect = @alignCast(@fieldParentPtr("interface", r));1299 const r_indirect: *ReaderIndirect = @alignCast(@fieldParentPtr("interface", r));
12981300
1299 // If there's no room remaining in the buffer at all, make room.1301 // If there's no room remaining in the buffer at all, make room.
...@@ -1301,12 +1303,12 @@ pub const ReaderIndirect = struct {...@@ -1301,12 +1303,12 @@ pub const ReaderIndirect = struct {
1301 try r.rebase(r.buffer.len);1303 try r.rebase(r.buffer.len);
1302 }1304 }
13031305
1304 var writer: std.Io.Writer = .{1306 var writer: Io.Writer = .{
1305 .buffer = r.buffer,1307 .buffer = r.buffer,
1306 .end = r.end,1308 .end = r.end,
1307 .vtable = &.{1309 .vtable = &.{
1308 .drain = std.Io.Writer.unreachableDrain,1310 .drain = Io.Writer.unreachableDrain,
1309 .rebase = std.Io.Writer.unreachableRebase,1311 .rebase = Io.Writer.unreachableRebase,
1310 },1312 },
1311 };1313 };
1312 defer r.end = writer.end;1314 defer r.end = writer.end;
lib/std/zig/WindowsSdk.zig+4-4
...@@ -77,7 +77,7 @@ pub fn free(sdk: WindowsSdk, allocator: Allocator) void {...@@ -77,7 +77,7 @@ pub fn free(sdk: WindowsSdk, allocator: Allocator) void {
77/// and a version. Returns slice of version strings sorted in descending order.77/// and a version. Returns slice of version strings sorted in descending order.
78/// Caller owns result.78/// Caller owns result.
79fn iterateAndFilterByVersion(79fn iterateAndFilterByVersion(
80 iterator: *std.fs.Dir.Iterator,80 iterator: *Io.Dir.Iterator,
81 allocator: Allocator,81 allocator: Allocator,
82 prefix: []const u8,82 prefix: []const u8,
83) error{OutOfMemory}![][]const u8 {83) error{OutOfMemory}![][]const u8 {
...@@ -608,7 +608,7 @@ pub const Installation = struct {...@@ -608,7 +608,7 @@ pub const Installation = struct {
608};608};
609609
610const MsvcLibDir = struct {610const MsvcLibDir = struct {
611 fn findInstancesDirViaSetup(allocator: Allocator) error{ OutOfMemory, PathNotFound }!std.fs.Dir {611 fn findInstancesDirViaSetup(allocator: Allocator) error{ OutOfMemory, PathNotFound }!Io.Dir {
612 const vs_setup_key_path = "SOFTWARE\\Microsoft\\VisualStudio\\Setup";612 const vs_setup_key_path = "SOFTWARE\\Microsoft\\VisualStudio\\Setup";
613 const vs_setup_key = RegistryWtf8.openKey(windows.HKEY_LOCAL_MACHINE, vs_setup_key_path, .{}) catch |err| switch (err) {613 const vs_setup_key = RegistryWtf8.openKey(windows.HKEY_LOCAL_MACHINE, vs_setup_key_path, .{}) catch |err| switch (err) {
614 error.KeyNotFound => return error.PathNotFound,614 error.KeyNotFound => return error.PathNotFound,
...@@ -633,7 +633,7 @@ const MsvcLibDir = struct {...@@ -633,7 +633,7 @@ const MsvcLibDir = struct {
633 return std.fs.openDirAbsolute(instances_path, .{ .iterate = true }) catch return error.PathNotFound;633 return std.fs.openDirAbsolute(instances_path, .{ .iterate = true }) catch return error.PathNotFound;
634 }634 }
635635
636 fn findInstancesDirViaCLSID(allocator: Allocator) error{ OutOfMemory, PathNotFound }!std.fs.Dir {636 fn findInstancesDirViaCLSID(allocator: Allocator) error{ OutOfMemory, PathNotFound }!Io.Dir {
637 const setup_configuration_clsid = "{177f0c4a-1cd3-4de7-a32c-71dbbb9fa36d}";637 const setup_configuration_clsid = "{177f0c4a-1cd3-4de7-a32c-71dbbb9fa36d}";
638 const setup_config_key = RegistryWtf8.openKey(windows.HKEY_CLASSES_ROOT, "CLSID\\" ++ setup_configuration_clsid, .{}) catch |err| switch (err) {638 const setup_config_key = RegistryWtf8.openKey(windows.HKEY_CLASSES_ROOT, "CLSID\\" ++ setup_configuration_clsid, .{}) catch |err| switch (err) {
639 error.KeyNotFound => return error.PathNotFound,639 error.KeyNotFound => return error.PathNotFound,
...@@ -669,7 +669,7 @@ const MsvcLibDir = struct {...@@ -669,7 +669,7 @@ const MsvcLibDir = struct {
669 return std.fs.openDirAbsolute(instances_path, .{ .iterate = true }) catch return error.PathNotFound;669 return std.fs.openDirAbsolute(instances_path, .{ .iterate = true }) catch return error.PathNotFound;
670 }670 }
671671
672 fn findInstancesDir(allocator: Allocator) error{ OutOfMemory, PathNotFound }!std.fs.Dir {672 fn findInstancesDir(allocator: Allocator) error{ OutOfMemory, PathNotFound }!Io.Dir {
673 // First, try getting the packages cache path from the registry.673 // First, try getting the packages cache path from the registry.
674 // This only seems to exist when the path is different from the default.674 // This only seems to exist when the path is different from the default.
675 method1: {675 method1: {
lib/std/zig/llvm/Builder.zig+1-1
...@@ -9582,7 +9582,7 @@ pub fn dump(b: *Builder) void {...@@ -9582,7 +9582,7 @@ pub fn dump(b: *Builder) void {
9582 b.printToFile(stderr, &buffer) catch {};9582 b.printToFile(stderr, &buffer) catch {};
9583}9583}
95849584
9585pub fn printToFilePath(b: *Builder, io: Io, dir: std.fs.Dir, path: []const u8) !void {9585pub fn printToFilePath(b: *Builder, io: Io, dir: Io.Dir, path: []const u8) !void {
9586 var buffer: [4000]u8 = undefined;9586 var buffer: [4000]u8 = undefined;
9587 const file = try dir.createFile(io, path, .{});9587 const file = try dir.createFile(io, path, .{});
9588 defer file.close(io);9588 defer file.close(io);
lib/std/zip.zig+3-2
...@@ -7,6 +7,7 @@ const builtin = @import("builtin");...@@ -7,6 +7,7 @@ const builtin = @import("builtin");
7const is_le = builtin.target.cpu.arch.endian() == .little;7const is_le = builtin.target.cpu.arch.endian() == .little;
88
9const std = @import("std");9const std = @import("std");
10const Io = std.Io;
10const File = std.Io.File;11const File = std.Io.File;
11const Writer = std.Io.Writer;12const Writer = std.Io.Writer;
12const Reader = std.Io.Reader;13const Reader = std.Io.Reader;
...@@ -461,7 +462,7 @@ pub const Iterator = struct {...@@ -461,7 +462,7 @@ pub const Iterator = struct {
461 stream: *File.Reader,462 stream: *File.Reader,
462 options: ExtractOptions,463 options: ExtractOptions,
463 filename_buf: []u8,464 filename_buf: []u8,
464 dest: std.fs.Dir,465 dest: Io.Dir,
465 ) !void {466 ) !void {
466 if (filename_buf.len < self.filename_len)467 if (filename_buf.len < self.filename_len)
467 return error.ZipInsufficientBuffer;468 return error.ZipInsufficientBuffer;
...@@ -650,7 +651,7 @@ pub const ExtractOptions = struct {...@@ -650,7 +651,7 @@ pub const ExtractOptions = struct {
650};651};
651652
652/// Extract the zipped files to the given `dest` directory.653/// Extract the zipped files to the given `dest` directory.
653pub fn extract(dest: std.fs.Dir, fr: *File.Reader, options: ExtractOptions) !void {654pub fn extract(dest: Io.Dir, fr: *File.Reader, options: ExtractOptions) !void {
654 if (options.verify_checksums) @panic("TODO unimplemented");655 if (options.verify_checksums) @panic("TODO unimplemented");
655656
656 var iter = try Iterator.init(fr);657 var iter = try Iterator.init(fr);
src/Compilation.zig+2-2
...@@ -446,7 +446,7 @@ pub const Path = struct {...@@ -446,7 +446,7 @@ pub const Path = struct {
446 }446 }
447447
448 /// Given a `Path`, returns the directory handle and sub path to be used to open the path.448 /// Given a `Path`, returns the directory handle and sub path to be used to open the path.
449 pub fn openInfo(p: Path, dirs: Directories) struct { fs.Dir, []const u8 } {449 pub fn openInfo(p: Path, dirs: Directories) struct { Io.Dir, []const u8 } {
450 const dir = switch (p.root) {450 const dir = switch (p.root) {
451 .none => {451 .none => {
452 const cwd_sub_path = absToCwdRelative(p.sub_path, dirs.cwd);452 const cwd_sub_path = absToCwdRelative(p.sub_path, dirs.cwd);
...@@ -1872,7 +1872,7 @@ pub const CreateDiagnostic = union(enum) {...@@ -1872,7 +1872,7 @@ pub const CreateDiagnostic = union(enum) {
1872 pub const CreateCachePath = struct {1872 pub const CreateCachePath = struct {
1873 which: enum { local, global },1873 which: enum { local, global },
1874 sub: []const u8,1874 sub: []const u8,
1875 err: (fs.Dir.MakeError || fs.Dir.OpenError || fs.Dir.StatFileError),1875 err: (Io.Dir.MakeError || Io.Dir.OpenError || Io.Dir.StatFileError),
1876 };1876 };
1877 pub fn format(diag: CreateDiagnostic, w: *Writer) Writer.Error!void {1877 pub fn format(diag: CreateDiagnostic, w: *Writer) Writer.Error!void {
1878 switch (diag) {1878 switch (diag) {
src/Package/Fetch/git.zig+2-2
...@@ -214,7 +214,7 @@ pub const Repository = struct {...@@ -214,7 +214,7 @@ pub const Repository = struct {
214 pub fn checkout(214 pub fn checkout(
215 repository: *Repository,215 repository: *Repository,
216 io: Io,216 io: Io,
217 worktree: std.fs.Dir,217 worktree: Io.Dir,
218 commit_oid: Oid,218 commit_oid: Oid,
219 diagnostics: *Diagnostics,219 diagnostics: *Diagnostics,
220 ) !void {220 ) !void {
...@@ -231,7 +231,7 @@ pub const Repository = struct {...@@ -231,7 +231,7 @@ pub const Repository = struct {
231 fn checkoutTree(231 fn checkoutTree(
232 repository: *Repository,232 repository: *Repository,
233 io: Io,233 io: Io,
234 dir: std.fs.Dir,234 dir: Io.Dir,
235 tree_oid: Oid,235 tree_oid: Oid,
236 current_path: []const u8,236 current_path: []const u8,
237 diagnostics: *Diagnostics,237 diagnostics: *Diagnostics,
src/fmt.zig+3-3
...@@ -204,7 +204,7 @@ pub fn run(gpa: Allocator, arena: Allocator, io: Io, args: []const []const u8) !...@@ -204,7 +204,7 @@ pub fn run(gpa: Allocator, arena: Allocator, io: Io, args: []const []const u8) !
204 }204 }
205}205}
206206
207fn fmtPath(fmt: *Fmt, file_path: []const u8, check_mode: bool, dir: fs.Dir, sub_path: []const u8) !void {207fn fmtPath(fmt: *Fmt, file_path: []const u8, check_mode: bool, dir: Io.Dir, sub_path: []const u8) !void {
208 fmtPathFile(fmt, file_path, check_mode, dir, sub_path) catch |err| switch (err) {208 fmtPathFile(fmt, file_path, check_mode, dir, sub_path) catch |err| switch (err) {
209 error.IsDir, error.AccessDenied => return fmtPathDir(fmt, file_path, check_mode, dir, sub_path),209 error.IsDir, error.AccessDenied => return fmtPathDir(fmt, file_path, check_mode, dir, sub_path),
210 else => {210 else => {
...@@ -219,7 +219,7 @@ fn fmtPathDir(...@@ -219,7 +219,7 @@ fn fmtPathDir(
219 fmt: *Fmt,219 fmt: *Fmt,
220 file_path: []const u8,220 file_path: []const u8,
221 check_mode: bool,221 check_mode: bool,
222 parent_dir: fs.Dir,222 parent_dir: Io.Dir,
223 parent_sub_path: []const u8,223 parent_sub_path: []const u8,
224) !void {224) !void {
225 const io = fmt.io;225 const io = fmt.io;
...@@ -257,7 +257,7 @@ fn fmtPathFile(...@@ -257,7 +257,7 @@ fn fmtPathFile(
257 fmt: *Fmt,257 fmt: *Fmt,
258 file_path: []const u8,258 file_path: []const u8,
259 check_mode: bool,259 check_mode: bool,
260 dir: fs.Dir,260 dir: Io.Dir,
261 sub_path: []const u8,261 sub_path: []const u8,
262) !void {262) !void {
263 const io = fmt.io;263 const io = fmt.io;
src/link/Lld.zig+4-3
...@@ -400,7 +400,7 @@ fn coffLink(lld: *Lld, arena: Allocator) !void {...@@ -400,7 +400,7 @@ fn coffLink(lld: *Lld, arena: Allocator) !void {
400 // regarding eliding redundant object -> object transformations.400 // regarding eliding redundant object -> object transformations.
401 return error.NoObjectsToLink;401 return error.NoObjectsToLink;
402 };402 };
403 try std.fs.Dir.copyFile(403 try Io.Dir.copyFile(
404 the_object_path.root_dir.handle,404 the_object_path.root_dir.handle,
405 the_object_path.sub_path,405 the_object_path.sub_path,
406 directory.handle,406 directory.handle,
...@@ -816,7 +816,7 @@ fn elfLink(lld: *Lld, arena: Allocator) !void {...@@ -816,7 +816,7 @@ fn elfLink(lld: *Lld, arena: Allocator) !void {
816 // regarding eliding redundant object -> object transformations.816 // regarding eliding redundant object -> object transformations.
817 return error.NoObjectsToLink;817 return error.NoObjectsToLink;
818 };818 };
819 try std.fs.Dir.copyFile(819 try Io.Dir.copyFile(
820 the_object_path.root_dir.handle,820 the_object_path.root_dir.handle,
821 the_object_path.sub_path,821 the_object_path.sub_path,
822 directory.handle,822 directory.handle,
...@@ -1371,7 +1371,7 @@ fn wasmLink(lld: *Lld, arena: Allocator) !void {...@@ -1371,7 +1371,7 @@ fn wasmLink(lld: *Lld, arena: Allocator) !void {
1371 // regarding eliding redundant object -> object transformations.1371 // regarding eliding redundant object -> object transformations.
1372 return error.NoObjectsToLink;1372 return error.NoObjectsToLink;
1373 };1373 };
1374 try fs.Dir.copyFile(1374 try Io.Dir.copyFile(
1375 the_object_path.root_dir.handle,1375 the_object_path.root_dir.handle,
1376 the_object_path.sub_path,1376 the_object_path.sub_path,
1377 directory.handle,1377 directory.handle,
...@@ -1692,6 +1692,7 @@ fn spawnLld(comp: *Compilation, arena: Allocator, argv: []const []const u8) !voi...@@ -1692,6 +1692,7 @@ fn spawnLld(comp: *Compilation, arena: Allocator, argv: []const []const u8) !voi
1692}1692}
16931693
1694const std = @import("std");1694const std = @import("std");
1695const Io = std.Io;
1695const Allocator = std.mem.Allocator;1696const Allocator = std.mem.Allocator;
1696const Cache = std.Build.Cache;1697const Cache = std.Build.Cache;
1697const allocPrint = std.fmt.allocPrint;1698const allocPrint = std.fmt.allocPrint;
src/link/MachO.zig+1-1
...@@ -3573,7 +3573,7 @@ pub fn getTarget(self: *const MachO) *const std.Target {...@@ -3573,7 +3573,7 @@ pub fn getTarget(self: *const MachO) *const std.Target {
3573/// into a new inode, remove the original file, and rename the copy to match3573/// into a new inode, remove the original file, and rename the copy to match
3574/// the original file. This is super messy, but there doesn't seem any other3574/// the original file. This is super messy, but there doesn't seem any other
3575/// way to please the XNU.3575/// way to please the XNU.
3576pub fn invalidateKernelCache(dir: fs.Dir, sub_path: []const u8) !void {3576pub fn invalidateKernelCache(dir: Io.Dir, sub_path: []const u8) !void {
3577 const tracy = trace(@src());3577 const tracy = trace(@src());
3578 defer tracy.end();3578 defer tracy.end();
3579 if (builtin.target.os.tag.isDarwin() and builtin.target.cpu.arch == .aarch64) {3579 if (builtin.target.os.tag.isDarwin() and builtin.target.cpu.arch == .aarch64) {