authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-10-08 22:37:39-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-10-29 06:20:49-07:00
log750b1431bf34b238bd991b2ee3b50e81ff20b667
treee99550f5c65f7b014baf7d9b56332c774daca3da
parenteadfefa002b642d1b9173fa7d9a281a70a61e233

std: fix some Io compilation errors


6 files changed, 16 insertions(+), 9 deletions(-)

lib/std/Io/Dir.zig+1-1
......@@ -263,6 +263,6 @@ pub const StatPathError = File.OpenError || File.StatError;
263263/// * On Windows, `sub_path` should be encoded as [WTF-8](https://simonsapin.github.io/wtf-8/).
264264/// * On WASI, `sub_path` should be encoded as valid UTF-8.
265265/// * On other platforms, `sub_path` is an opaque sequence of bytes with no particular encoding.
266pub fn statPath(dir: Dir, io: Io, sub_path: []const u8) StatPathError!File.Stat {
266pub fn statPath(dir: Dir, io: Io, sub_path: []const u8) StatPathError!Stat {
267267 return io.vtable.dirStatPath(io.userdata, dir, sub_path);
268268}
lib/std/fs/test.zig+1-1
......@@ -1928,7 +1928,7 @@ test "'.' and '..' in fs.Dir functions" {
19281928 try ctx.dir.writeFile(.{ .sub_path = update_path, .data = "something" });
19291929 var dir = ctx.dir.adaptToNewApi();
19301930 const prev_status = try dir.updateFile(io, file_path, dir, update_path, .{});
1931 try testing.expectEqual(fs.Dir.PrevStatus.stale, prev_status);
1931 try testing.expectEqual(Io.Dir.PrevStatus.stale, prev_status);
19321932
19331933 try ctx.dir.deleteDir(subdir_path);
19341934 }
lib/std/http/Client.zig+9-4
......@@ -300,7 +300,7 @@ pub const Connection = struct {
300300 remote_host: HostName,
301301 port: u16,
302302 stream: Io.net.Stream,
303 ) error{ OutOfMemory, TlsInitializationFailed }!*Tls {
303 ) !*Tls {
304304 const io = client.io;
305305 const gpa = client.allocator;
306306 const alloc_len = allocLen(client, remote_host.bytes.len);
......@@ -320,7 +320,7 @@ pub const Connection = struct {
320320 const tls: *Tls = @ptrCast(base);
321321 var random_buffer: [176]u8 = undefined;
322322 std.crypto.random.bytes(&random_buffer);
323 const now_ts = if (Io.Clock.real.now(io)) |ts| ts.toSeconds() else |_| return error.TlsInitializationFailed;
323 const now_ts = if (Io.Clock.real.now(io)) |ts| ts.toSeconds() else |err| return err;
324324 tls.* = .{
325325 .connection = .{
326326 .client = client,
......@@ -349,7 +349,11 @@ pub const Connection = struct {
349349 // the content length which is used to detect truncation attacks.
350350 .allow_truncation_attacks = true,
351351 },
352 ) catch return error.TlsInitializationFailed,
352 ) catch |err| switch (err) {
353 error.WriteFailed => return tls.connection.stream_writer.err.?,
354 error.ReadFailed => return tls.connection.stream_reader.err.?,
355 else => |e| return e,
356 },
353357 };
354358 return tls;
355359 }
......@@ -1446,7 +1450,8 @@ pub fn connectTcpOptions(client: *Client, options: ConnectTcpOptions) ConnectTcp
14461450 const tc = Connection.Tls.create(client, proxied_host, proxied_port, stream) catch |err| switch (err) {
14471451 error.OutOfMemory => |e| return e,
14481452 error.Unexpected => |e| return e,
1449 error.UnsupportedClock => return error.TlsInitializationFailed,
1453 error.Canceled => |e| return e,
1454 else => return error.TlsInitializationFailed,
14501455 };
14511456 client.connection_pool.addUsed(&tc.connection);
14521457 return &tc.connection;
lib/std/os/linux/IoUring.zig+2-2
......@@ -2459,12 +2459,12 @@ test "timeout (after a relative time)" {
24592459 const margin = 5;
24602460 const ts: linux.kernel_timespec = .{ .sec = 0, .nsec = ms * 1000000 };
24612461
2462 const started = try std.Io.Timestamp.now(io, .awake);
2462 const started = try std.Io.Clock.awake.now(io);
24632463 const sqe = try ring.timeout(0x55555555, &ts, 0, 0);
24642464 try testing.expectEqual(linux.IORING_OP.TIMEOUT, sqe.opcode);
24652465 try testing.expectEqual(@as(u32, 1), try ring.submit());
24662466 const cqe = try ring.copy_cqe();
2467 const stopped = try std.Io.Timestamp.now(io, .awake);
2467 const stopped = try std.Io.Clock.awake.now(io);
24682468
24692469 try testing.expectEqual(linux.io_uring_cqe{
24702470 .user_data = 0x55555555,
lib/std/posix.zig+2
......@@ -357,6 +357,7 @@ pub const FChmodAtError = FChmodError || error{
357357 ProcessFdQuotaExceeded,
358358 /// The procfs fallback was used but the system exceeded it open file limit.
359359 SystemFdQuotaExceeded,
360 Canceled,
360361};
361362
362363/// Changes the `mode` of `path` relative to the directory referred to by
......@@ -487,6 +488,7 @@ fn fchmodat2(dirfd: fd_t, path: []const u8, mode: mode_t, flags: u32) FChmodAtEr
487488 error.NameTooLong => unreachable,
488489 error.FileNotFound => unreachable,
489490 error.InvalidUtf8 => unreachable,
491 error.Canceled => return error.Canceled,
490492 else => |e| return e,
491493 };
492494 if ((stat.mode & S.IFMT) == S.IFLNK)
lib/std/time.zig+1-1
......@@ -204,7 +204,7 @@ test Timer {
204204
205205 var timer = try Timer.start();
206206
207 try std.Io.Duration.sleep(.fromMilliseconds(10), io);
207 try std.Io.Clock.Duration.sleep(.{ .clock = .awake, .raw = .fromMilliseconds(10) }, io);
208208 const time_0 = timer.read();
209209 try testing.expect(time_0 > 0);
210210