authorgravatar for kcbanner@gmail.comCasey Banner <kcbanner@gmail.com> 2025-09-06 01:13:34-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-09-06 18:51:26-07:00
logcc6d9fdbf40cc23d2ec47d2f7db74a84fbefd1ac
tree70f9c14c9c40c06e61aad70cd9a301ec9dc25030
parent4c012756643ee1f18740ac88180635defa8dc6f2

webui: fixup build errors in fuzz / time_report


2 files changed, 20 insertions(+), 19 deletions(-)

lib/build-web/fuzz.zig+6-6
......@@ -101,22 +101,22 @@ const SourceLocationIndex = enum(u32) {
101101
102102 fn sourceLocationLinkHtml(
103103 sli: SourceLocationIndex,
104 out: *std.ArrayListUnmanaged(u8),
104 out: *std.ArrayList(u8),
105105 focused: bool,
106 ) Allocator.Error!void {
106 ) error{OutOfMemory}!void {
107107 const sl = sli.ptr();
108 try out.writer(gpa).print("<code{s}>", .{
108 try out.print(gpa, "<code{s}>", .{
109109 @as([]const u8, if (focused) " class=\"status-running\"" else ""),
110110 });
111111 try sli.appendPath(out);
112 try out.writer(gpa).print(":{d}:{d} </code><button class=\"linkish\" onclick=\"wasm_exports.fuzzSelectSli({d});\">View</button>", .{
112 try out.print(gpa, ":{d}:{d} </code><button class=\"linkish\" onclick=\"wasm_exports.fuzzSelectSli({d});\">View</button>", .{
113113 sl.line,
114114 sl.column,
115115 @intFromEnum(sli),
116116 });
117117 }
118118
119 fn appendPath(sli: SourceLocationIndex, out: *std.ArrayListUnmanaged(u8)) Allocator.Error!void {
119 fn appendPath(sli: SourceLocationIndex, out: *std.ArrayList(u8)) error{OutOfMemory}!void {
120120 const sl = sli.ptr();
121121 const file = coverage.fileAt(sl.file);
122122 const file_name = coverage.stringAt(file.basename);
......@@ -294,7 +294,7 @@ fn updateStats() error{OutOfMemory}!void {
294294}
295295
296296fn updateEntryPoints() error{OutOfMemory}!void {
297 var html: std.ArrayListUnmanaged(u8) = .empty;
297 var html: std.ArrayList(u8) = .empty;
298298 defer html.deinit(gpa);
299299 for (entry_points.items) |sli| {
300300 try html.appendSlice(gpa, "<li>");
lib/build-web/time_report.zig+14-13
......@@ -44,7 +44,7 @@ pub fn genericResultMessage(msg_bytes: []u8) error{OutOfMemory}!void {
4444 js.updateGeneric(msg.step_idx, inner_html.ptr, inner_html.len);
4545}
4646
47pub fn compileResultMessage(msg_bytes: []u8) error{OutOfMemory}!void {
47pub fn compileResultMessage(msg_bytes: []u8) error{ OutOfMemory, WriteFailed }!void {
4848 const max_table_rows = 500;
4949
5050 if (msg_bytes.len < @sizeOf(abi.CompileResult)) @panic("malformed CompileResult message");
......@@ -166,10 +166,11 @@ pub fn compileResultMessage(msg_bytes: []u8) error{OutOfMemory}!void {
166166 });
167167 defer gpa.free(inner_html);
168168
169 var file_table_html: std.ArrayListUnmanaged(u8) = .empty;
170 defer file_table_html.deinit(gpa);
169 var file_table_html: std.Io.Writer.Allocating = .init(gpa);
170 defer file_table_html.deinit();
171
171172 for (slowest_files[0..@min(max_table_rows, slowest_files.len)]) |file| {
172 try file_table_html.writer(gpa).print(
173 try file_table_html.writer.print(
173174 \\<tr>
174175 \\ <th scope="row"><code>{f}</code></th>
175176 \\ <td>{D}</td>
......@@ -187,17 +188,17 @@ pub fn compileResultMessage(msg_bytes: []u8) error{OutOfMemory}!void {
187188 });
188189 }
189190 if (slowest_files.len > max_table_rows) {
190 try file_table_html.writer(gpa).print(
191 try file_table_html.writer.print(
191192 \\<tr><td colspan="4">{d} more rows omitted</td></tr>
192193 \\
193194 , .{slowest_files.len - max_table_rows});
194195 }
195196
196 var decl_table_html: std.ArrayListUnmanaged(u8) = .empty;
197 defer decl_table_html.deinit(gpa);
197 var decl_table_html: std.Io.Writer.Allocating = .init(gpa);
198 defer decl_table_html.deinit();
198199
199200 for (slowest_decls[0..@min(max_table_rows, slowest_decls.len)]) |decl| {
200 try decl_table_html.writer(gpa).print(
201 try decl_table_html.writer.print(
201202 \\<tr>
202203 \\ <th scope="row"><code>{f}</code></th>
203204 \\ <th scope="row"><code>{f}</code></th>
......@@ -219,7 +220,7 @@ pub fn compileResultMessage(msg_bytes: []u8) error{OutOfMemory}!void {
219220 });
220221 }
221222 if (slowest_decls.len > max_table_rows) {
222 try decl_table_html.writer(gpa).print(
223 try decl_table_html.writer.print(
223224 \\<tr><td colspan="6">{d} more rows omitted</td></tr>
224225 \\
225226 , .{slowest_decls.len - max_table_rows});
......@@ -229,10 +230,10 @@ pub fn compileResultMessage(msg_bytes: []u8) error{OutOfMemory}!void {
229230 hdr.step_idx,
230231 inner_html.ptr,
231232 inner_html.len,
232 file_table_html.items.ptr,
233 file_table_html.items.len,
234 decl_table_html.items.ptr,
235 decl_table_html.items.len,
233 file_table_html.written().ptr,
234 file_table_html.written().len,
235 decl_table_html.written().ptr,
236 decl_table_html.written().len,
236237 hdr.flags.use_llvm,
237238 );
238239}