std.Build: avoid use of catch unreachable

Usage of `catch unreachable` in build scripts is completely harmless
because build scripts are always run in Debug mode, however, it sets a
poor example for beginners to learn from.
This commit is contained in:
Andrew Kelley
2023-01-31 14:02:32 -07:00
parent 13a9616540
commit 90e48d4b34
13 changed files with 169 additions and 161 deletions

View File

@@ -18,7 +18,7 @@ pub fn create(
source: std.Build.FileSource,
expected_matches: []const []const u8,
) *CheckFileStep {
const self = builder.allocator.create(CheckFileStep) catch unreachable;
const self = builder.allocator.create(CheckFileStep) catch @panic("OOM");
self.* = CheckFileStep{
.builder = builder,
.step = Step.init(.check_file, "CheckFile", builder.allocator, make),