mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-04-17 13:02:42 +00:00
Zig 0.15: zig build test
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user