diff --git a/src/ThreadPool.zig b/src/ThreadPool.zig index fcc2277..1d0123b 100644 --- a/src/ThreadPool.zig +++ b/src/ThreadPool.zig @@ -376,7 +376,7 @@ const Thread = struct { thread_pool.notify(is_waking); is_waking = false; - const task = @fieldParentPtr(Task, "node", result.node); + const task: *Task = @fieldParentPtr("node", result.node); (task.callback)(task); } } diff --git a/src/backend/epoll.zig b/src/backend/epoll.zig index 9e7866a..ae4ec7d 100644 --- a/src/backend/epoll.zig +++ b/src/backend/epoll.zig @@ -429,7 +429,7 @@ pub const Loop = struct { /// This is the main callback for the threadpool to perform work /// on completions for the loop. fn thread_perform(t: *ThreadPool.Task) void { - const c = @fieldParentPtr(Completion, "task", t); + const c: *Completion = @fieldParentPtr("task", t); // Do our task c.task_result = c.perform(); diff --git a/src/backend/iocp.zig b/src/backend/iocp.zig index 55b08ea..f4383f8 100644 --- a/src/backend/iocp.zig +++ b/src/backend/iocp.zig @@ -323,7 +323,7 @@ pub const Loop = struct { continue; } - break :completion @fieldParentPtr(Completion, "overlapped", overlapped_ptr.?); + break :completion @fieldParentPtr("overlapped", overlapped_ptr.?); } else completion: { // JobObjects are a special case where the OVERLAPPED_ENTRY fields are interpreted differently. // When JOBOBJECT_ASSOCIATE_COMPLETION_PORT is used, lpOverlapped actually contains the message diff --git a/src/backend/kqueue.zig b/src/backend/kqueue.zig index b2386ef..61a8c5c 100644 --- a/src/backend/kqueue.zig +++ b/src/backend/kqueue.zig @@ -933,7 +933,7 @@ pub const Loop = struct { /// This is the main callback for the threadpool to perform work /// on completions for the loop. fn thread_perform(t: *ThreadPool.Task) void { - const c = @fieldParentPtr(Completion, "task", t); + const c: *Completion = @fieldParentPtr("task", t); // Do our task c.result = c.perform(null); diff --git a/src/build/ScdocStep.zig b/src/build/ScdocStep.zig index 1c7d4bb..7d643b6 100644 --- a/src/build/ScdocStep.zig +++ b/src/build/ScdocStep.zig @@ -49,7 +49,7 @@ pub fn init(builder: *Build) ScdocStep { fn make(step: *std.Build.Step, progress: *std.Progress.Node) !void { _ = progress; - const self = @fieldParentPtr(ScdocStep, "step", step); + const self: *ScdocStep = @fieldParentPtr("step", step); // Create our cache path // TODO(mitchellh): ideally this would be pure zig @@ -129,7 +129,7 @@ const InstallStep = struct { } fn make(step: *Step, progress: *std.Progress.Node) !void { - const self = @fieldParentPtr(InstallStep, "step", step); + const self: *InstallStep = @fieldParentPtr("step", step); // Get our absolute output path var path = self.scdoc.out_path; diff --git a/src/c_api.zig b/src/c_api.zig index d2fdb78..a6e7db2 100644 --- a/src/c_api.zig +++ b/src/c_api.zig @@ -97,11 +97,11 @@ export fn xev_threadpool_task_init( t.* = .{ .callback = (struct { fn callback(inner_t: *xev.ThreadPool.Task) void { - @fieldParentPtr( - Task, + const task: *Task = @alignCast(@fieldParentPtr( "data", @as(*Task.Data, @ptrCast(inner_t)), - ).c_callback(inner_t); + )); + task.c_callback(inner_t); } }).callback, }; diff --git a/src/watcher/stream.zig b/src/watcher/stream.zig index c1f2c93..7f5df6f 100644 --- a/src/watcher/stream.zig +++ b/src/watcher/stream.zig @@ -220,7 +220,7 @@ pub fn Writeable(comptime xev: type, comptime T: type, comptime options: Options /// originally is from a write request. This is useful for getting /// the WriteRequest back in a callback from queuedWrite. pub fn from(c: *xev.Completion) *WriteRequest { - return @fieldParentPtr(WriteRequest, "completion", c); + return @fieldParentPtr("completion", c); } };