aboutsummaryrefslogtreecommitdiff
path: root/lib/compiler/std-docs.zig
diff options
context:
space:
mode:
authorkcbanner <kcbanner@gmail.com>2025-10-08 03:49:13 -0400
committerkcbanner <kcbanner@gmail.com>2025-10-09 01:06:09 -0400
commit8b6cdc3d8224cf1e97a970f78281db2fcd14b7a2 (patch)
tree2b7c53bbec33d5c1d9edde483a51fc196ed602e6 /lib/compiler/std-docs.zig
parent447280d0d98b540aed4df83db7cf95a417d81611 (diff)
downloadzig-8b6cdc3d8224cf1e97a970f78281db2fcd14b7a2.tar.gz
zig-8b6cdc3d8224cf1e97a970f78281db2fcd14b7a2.zip
- Rework common translate-c and cImport logic into `Compilation.translateC`
- Add std.zig.Server.allocErrorBundle, replace duplicates
Diffstat (limited to 'lib/compiler/std-docs.zig')
-rw-r--r--lib/compiler/std-docs.zig15
1 files changed, 1 insertions, 14 deletions
diff --git a/lib/compiler/std-docs.zig b/lib/compiler/std-docs.zig
index b6696b5680..e80c3d3dcd 100644
--- a/lib/compiler/std-docs.zig
+++ b/lib/compiler/std-docs.zig
@@ -345,20 +345,7 @@ fn buildWasmBinary(
}
},
.error_bundle => {
- const EbHdr = std.zig.Server.Message.ErrorBundle;
- const eb_hdr = @as(*align(1) const EbHdr, @ptrCast(body));
- const extra_bytes =
- body[@sizeOf(EbHdr)..][0 .. @sizeOf(u32) * eb_hdr.extra_len];
- const string_bytes =
- body[@sizeOf(EbHdr) + extra_bytes.len ..][0..eb_hdr.string_bytes_len];
- // TODO: use @ptrCast when the compiler supports it
- const unaligned_extra = std.mem.bytesAsSlice(u32, extra_bytes);
- const extra_array = try arena.alloc(u32, unaligned_extra.len);
- @memcpy(extra_array, unaligned_extra);
- result_error_bundle = .{
- .string_bytes = try arena.dupe(u8, string_bytes),
- .extra = extra_array,
- };
+ result_error_bundle = try std.zig.Server.allocErrorBundle(arena, body);
},
.emit_digest => {
const EmitDigest = std.zig.Server.Message.EmitDigest;