authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-12-18 15:21:18-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-01-01 17:51:20-07:00
log90cc408c1479e5e7ccd82369253d19f79d2812a5
tree7c2175882a0dad3617f87f5f56fca05cbbe7cf19
parent38f2172b0a31ec09a39c3222fd7cde2f2802ae8e

fix --show-builtin when no positional argument is provided


1 files changed, 7 insertions(+), 0 deletions(-)

src/main.zig+7
...@@ -2511,6 +2511,13 @@ fn buildOutputType(...@@ -2511,6 +2511,13 @@ fn buildOutputType(
2511 fatal("`zig test` expects a zig source file argument", .{});2511 fatal("`zig test` expects a zig source file argument", .{});
2512 }2512 }
25132513
2514 if (show_builtin and root_src_file == null) {
2515 // Without this, there will be no main module created and no zig
2516 // compilation unit, and therefore also no builtin.zig contents
2517 // created.
2518 root_src_file = "dummy.zig";
2519 }
2520
2514 if (root_src_file) |unresolved_src_path| {2521 if (root_src_file) |unresolved_src_path| {
2515 if (create_module.modules.count() != 0) {2522 if (create_module.modules.count() != 0) {
2516 fatal("main module provided both by '--mod {s} {}{s}' and by positional argument '{s}'", .{2523 fatal("main module provided both by '--mod {s} {}{s}' and by positional argument '{s}'", .{