diff options
| author | Manlio Perillo <[email protected]> | 2023-05-20 07:21:11 +0200 |
|---|---|---|
| committer | Manlio Perillo <[email protected]> | 2023-05-20 07:25:53 +0200 |
| commit | 3e38a4fc844e572ee0a8b5cb61558763de0f2157 (patch) | |
| tree | 5c79c604b43f765ba3aa85ceafdeac1675df17d2 /build.zig | |
| parent | d0de9e534898451016e8f72328e70d76452c7c15 (diff) | |
| download | ziglings-3e38a4fc844e572ee0a8b5cb61558763de0f2157.tar.xz ziglings-3e38a4fc844e572ee0a8b5cb61558763de0f2157.zip | |
build: in `ZiglingStep.check_output` panic in case of OOM
This is necessary since, when trimLines returns `std.mem.Allocator.Error`,
no error message will be displayed to the user.
An alternative is to use `std.Build.Step.fail`, but using @panic("OOM")
is simpler and consistent with existing code.
Diffstat (limited to 'build.zig')
| -rw-r--r-- | build.zig | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -304,7 +304,7 @@ const ZiglingStep = struct { // Validate the output. // NOTE: exercise.output can never contain a CR character. // See https://ziglang.org/documentation/master/#Source-Encoding. - const output = try trimLines(b.allocator, raw_output); + const output = trimLines(b.allocator, raw_output) catch @panic("OOM"); const exercise_output = self.exercise.output; if (!std.mem.eql(u8, output, self.exercise.output)) { return self.step.fail( |
