From ff503edc044104d3d4cf2c2790859561eeca8aec Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Tue, 6 Aug 2024 12:33:34 -0700 Subject: Compilation: fix not showing sub-errors for autodocs --- src/Compilation.zig | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/Compilation.zig') diff --git a/src/Compilation.zig b/src/Compilation.zig index 8c9e18bc98..4292147689 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -4201,10 +4201,11 @@ fn workerDocsWasm(comp: *Compilation, parent_prog_node: std.Progress.Node) void const prog_node = parent_prog_node.start("Compile Autodocs", 0); defer prog_node.end(); - workerDocsWasmFallible(comp, prog_node) catch |err| { - comp.lockAndSetMiscFailure(.docs_wasm, "unable to build autodocs: {s}", .{ + workerDocsWasmFallible(comp, prog_node) catch |err| switch (err) { + error.SubCompilationFailed => return, // error reported already + else => comp.lockAndSetMiscFailure(.docs_wasm, "unable to build autodocs: {s}", .{ @errorName(err), - }); + }), }; } -- cgit v1.2.3 From 904fcda736142c07237d0d12728ef5347468cfbe Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Tue, 6 Aug 2024 12:45:38 -0700 Subject: Compilation: fix -femit-docs --- src/Compilation.zig | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'src/Compilation.zig') diff --git a/src/Compilation.zig b/src/Compilation.zig index 4292147689..1fd2380137 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -4275,8 +4275,29 @@ fn workerDocsWasmFallible(comp: *Compilation, prog_node: std.Progress.Node) anye .cc_argv = &.{}, .parent = null, .builtin_mod = null, - .builtin_modules = null, // there is only one module in this compilation + .builtin_modules = null, + }); + const walk_mod = try Package.Module.create(arena, .{ + .global_cache_directory = comp.global_cache_directory, + .paths = .{ + .root = .{ + .root_dir = comp.zig_lib_directory, + .sub_path = "docs/wasm", + }, + .root_src_path = "Walk.zig", + }, + .fully_qualified_name = "Walk", + .inherited = .{ + .resolved_target = resolved_target, + .optimize_mode = optimize_mode, + }, + .global = config, + .cc_argv = &.{}, + .parent = root_mod, + .builtin_mod = root_mod.getBuiltinDependency(), + .builtin_modules = null, // `builtin_mod` is set }); + try root_mod.deps.put(arena, "Walk", walk_mod); const bin_basename = try std.zig.binNameAlloc(arena, .{ .root_name = root_name, .target = resolved_target.result, -- cgit v1.2.3