From 90cc408c1479e5e7ccd82369253d19f79d2812a5 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Mon, 18 Dec 2023 15:21:18 -0700 Subject: [PATCH] fix --show-builtin when no positional argument is provided --- src/main.zig | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main.zig b/src/main.zig index a65c8959b3..3b3eb8941e 100644 --- a/src/main.zig +++ b/src/main.zig @@ -2511,6 +2511,13 @@ fn buildOutputType( fatal("`zig test` expects a zig source file argument", .{}); } + if (show_builtin and root_src_file == null) { + // Without this, there will be no main module created and no zig + // compilation unit, and therefore also no builtin.zig contents + // created. + root_src_file = "dummy.zig"; + } + if (root_src_file) |unresolved_src_path| { if (create_module.modules.count() != 0) { fatal("main module provided both by '--mod {s} {}{s}' and by positional argument '{s}'", .{