Commit cc6d9fdbf4

kcbanner <kcbanner@gmail.com>
2025-09-06 07:13:34
webui: fixup build errors in fuzz / time_report
1 parent 4c01275
Changed files (2)
lib/build-web/fuzz.zig
@@ -101,22 +101,22 @@ const SourceLocationIndex = enum(u32) {
 
     fn sourceLocationLinkHtml(
         sli: SourceLocationIndex,
-        out: *std.ArrayListUnmanaged(u8),
+        out: *std.ArrayList(u8),
         focused: bool,
-    ) Allocator.Error!void {
+    ) error{OutOfMemory}!void {
         const sl = sli.ptr();
-        try out.writer(gpa).print("<code{s}>", .{
+        try out.print(gpa, "<code{s}>", .{
             @as([]const u8, if (focused) " class=\"status-running\"" else ""),
         });
         try sli.appendPath(out);
-        try out.writer(gpa).print(":{d}:{d} </code><button class=\"linkish\" onclick=\"wasm_exports.fuzzSelectSli({d});\">View</button>", .{
+        try out.print(gpa, ":{d}:{d} </code><button class=\"linkish\" onclick=\"wasm_exports.fuzzSelectSli({d});\">View</button>", .{
             sl.line,
             sl.column,
             @intFromEnum(sli),
         });
     }
 
-    fn appendPath(sli: SourceLocationIndex, out: *std.ArrayListUnmanaged(u8)) Allocator.Error!void {
+    fn appendPath(sli: SourceLocationIndex, out: *std.ArrayList(u8)) error{OutOfMemory}!void {
         const sl = sli.ptr();
         const file = coverage.fileAt(sl.file);
         const file_name = coverage.stringAt(file.basename);
@@ -294,7 +294,7 @@ fn updateStats() error{OutOfMemory}!void {
 }
 
 fn updateEntryPoints() error{OutOfMemory}!void {
-    var html: std.ArrayListUnmanaged(u8) = .empty;
+    var html: std.ArrayList(u8) = .empty;
     defer html.deinit(gpa);
     for (entry_points.items) |sli| {
         try html.appendSlice(gpa, "<li>");
lib/build-web/time_report.zig
@@ -44,7 +44,7 @@ pub fn genericResultMessage(msg_bytes: []u8) error{OutOfMemory}!void {
     js.updateGeneric(msg.step_idx, inner_html.ptr, inner_html.len);
 }
 
-pub fn compileResultMessage(msg_bytes: []u8) error{OutOfMemory}!void {
+pub fn compileResultMessage(msg_bytes: []u8) error{ OutOfMemory, WriteFailed }!void {
     const max_table_rows = 500;
 
     if (msg_bytes.len < @sizeOf(abi.CompileResult)) @panic("malformed CompileResult message");
@@ -166,10 +166,11 @@ pub fn compileResultMessage(msg_bytes: []u8) error{OutOfMemory}!void {
     });
     defer gpa.free(inner_html);
 
-    var file_table_html: std.ArrayListUnmanaged(u8) = .empty;
-    defer file_table_html.deinit(gpa);
+    var file_table_html: std.Io.Writer.Allocating = .init(gpa);
+    defer file_table_html.deinit();
+
     for (slowest_files[0..@min(max_table_rows, slowest_files.len)]) |file| {
-        try file_table_html.writer(gpa).print(
+        try file_table_html.writer.print(
             \\<tr>
             \\  <th scope="row"><code>{f}</code></th>
             \\  <td>{D}</td>
@@ -187,17 +188,17 @@ pub fn compileResultMessage(msg_bytes: []u8) error{OutOfMemory}!void {
         });
     }
     if (slowest_files.len > max_table_rows) {
-        try file_table_html.writer(gpa).print(
+        try file_table_html.writer.print(
             \\<tr><td colspan="4">{d} more rows omitted</td></tr>
             \\
         , .{slowest_files.len - max_table_rows});
     }
 
-    var decl_table_html: std.ArrayListUnmanaged(u8) = .empty;
-    defer decl_table_html.deinit(gpa);
+    var decl_table_html: std.Io.Writer.Allocating = .init(gpa);
+    defer decl_table_html.deinit();
 
     for (slowest_decls[0..@min(max_table_rows, slowest_decls.len)]) |decl| {
-        try decl_table_html.writer(gpa).print(
+        try decl_table_html.writer.print(
             \\<tr>
             \\  <th scope="row"><code>{f}</code></th>
             \\  <th scope="row"><code>{f}</code></th>
@@ -219,7 +220,7 @@ pub fn compileResultMessage(msg_bytes: []u8) error{OutOfMemory}!void {
         });
     }
     if (slowest_decls.len > max_table_rows) {
-        try decl_table_html.writer(gpa).print(
+        try decl_table_html.writer.print(
             \\<tr><td colspan="6">{d} more rows omitted</td></tr>
             \\
         , .{slowest_decls.len - max_table_rows});
@@ -229,10 +230,10 @@ pub fn compileResultMessage(msg_bytes: []u8) error{OutOfMemory}!void {
         hdr.step_idx,
         inner_html.ptr,
         inner_html.len,
-        file_table_html.items.ptr,
-        file_table_html.items.len,
-        decl_table_html.items.ptr,
-        decl_table_html.items.len,
+        file_table_html.written().ptr,
+        file_table_html.written().len,
+        decl_table_html.written().ptr,
+        decl_table_html.written().len,
         hdr.flags.use_llvm,
     );
 }