Zig 0.15: zig build test

This commit is contained in:
Mitchell Hashimoto
2025-10-01 13:10:40 -07:00
parent 3770f97608
commit cb295b84a0
66 changed files with 1264 additions and 1144 deletions

View File

@@ -16,7 +16,7 @@ pub const Diagnostic = struct {
message: [:0]const u8,
/// Write the full user-friendly diagnostic message to the writer.
pub fn write(self: *const Diagnostic, writer: anytype) !void {
pub fn format(self: *const Diagnostic, writer: *std.Io.Writer) !void {
switch (self.location) {
.none => {},
.cli => |index| try writer.print("cli:{}:", .{index}),
@@ -157,11 +157,14 @@ pub const DiagnosticList = struct {
errdefer _ = self.list.pop();
if (comptime precompute_enabled) {
var buf = std.ArrayList(u8).init(alloc);
defer buf.deinit();
try diag.write(buf.writer());
var stream: std.Io.Writer.Allocating = .init(alloc);
defer stream.deinit();
diag.format(&stream.writer) catch |err| switch (err) {
// WriteFailed in this instance can only mean an OOM
error.WriteFailed => return error.OutOfMemory,
};
const owned: [:0]const u8 = try buf.toOwnedSliceSentinel(0);
const owned: [:0]const u8 = try stream.toOwnedSliceSentinel(0);
errdefer alloc.free(owned);
try self.precompute.messages.append(alloc, owned);