Merge pull request 'WIP - fix breaking zig change to @fieldParentPtr' (#72) from kamidev/exercises:fix_zig_breaking_pr_19470 into main

Reviewed-on: https://codeberg.org/ziglings/exercises/pulls/72
pull/73/head
Chris Boesch 6 months ago
commit c0ff1b70c1

@ -247,7 +247,7 @@ const ZiglingStep = struct {
fn make(step: *Step, prog_node: *std.Progress.Node) !void { fn make(step: *Step, prog_node: *std.Progress.Node) !void {
// NOTE: Using exit code 2 will prevent the Zig compiler to print the message: // NOTE: Using exit code 2 will prevent the Zig compiler to print the message:
// "error: the following build command failed with exit code 1:..." // "error: the following build command failed with exit code 1:..."
const self = @fieldParentPtr(ZiglingStep, "step", step); const self: *ZiglingStep = @alignCast(@fieldParentPtr("step", step));
if (self.exercise.skip) { if (self.exercise.skip) {
print("Skipping {s}\n\n", .{self.exercise.main_file}); print("Skipping {s}\n\n", .{self.exercise.main_file});
@ -495,8 +495,7 @@ const PrintStep = struct {
} }
fn make(step: *Step, _: *std.Progress.Node) !void { fn make(step: *Step, _: *std.Progress.Node) !void {
const self = @fieldParentPtr(PrintStep, "step", step); const self: *PrintStep = @alignCast(@fieldParentPtr("step", step));
print("{s}", .{self.message}); print("{s}", .{self.message});
} }
}; };

@ -152,7 +152,7 @@ const CheckNamedStep = struct {
fn make(step: *Step, _: *std.Progress.Node) !void { fn make(step: *Step, _: *std.Progress.Node) !void {
const b = step.owner; const b = step.owner;
const self = @fieldParentPtr(CheckNamedStep, "step", step); const self: *CheckNamedStep = @alignCast(@fieldParentPtr("step", step));
const ex = self.exercise; const ex = self.exercise;
const stderr_file = try fs.cwd().openFile( const stderr_file = try fs.cwd().openFile(
@ -204,7 +204,7 @@ const CheckStep = struct {
fn make(step: *Step, _: *std.Progress.Node) !void { fn make(step: *Step, _: *std.Progress.Node) !void {
const b = step.owner; const b = step.owner;
const self = @fieldParentPtr(CheckStep, "step", step); const self: *CheckStep = @alignCast(@fieldParentPtr("step", step));
const exercises = self.exercises; const exercises = self.exercises;
const stderr_file = try fs.cwd().openFile( const stderr_file = try fs.cwd().openFile(
@ -327,7 +327,7 @@ const FailStep = struct {
fn make(step: *Step, _: *std.Progress.Node) !void { fn make(step: *Step, _: *std.Progress.Node) !void {
const b = step.owner; const b = step.owner;
const self = @fieldParentPtr(FailStep, "step", step); const self: *FailStep = @alignCast(@fieldParentPtr("step", step));
try step.result_error_msgs.append(b.allocator, self.error_msg); try step.result_error_msgs.append(b.allocator, self.error_msg);
return error.MakeFailed; return error.MakeFailed;
@ -370,7 +370,7 @@ const HealStep = struct {
fn make(step: *Step, _: *std.Progress.Node) !void { fn make(step: *Step, _: *std.Progress.Node) !void {
const b = step.owner; const b = step.owner;
const self = @fieldParentPtr(HealStep, "step", step); const self: *HealStep = @alignCast(@fieldParentPtr("step", step));
return heal(b.allocator, self.exercises, self.work_path); return heal(b.allocator, self.exercises, self.work_path);
} }

Loading…
Cancel
Save