zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 24c8adc6ac40e5b73ae0caee0c559c008467d63a (tree)
parent 51e15a9650d4634d7d228617fc2aea3ecc2ed073
Author: Andrew Kelley <andrew@ziglang.org>
Date:   Tue,  3 Oct 2023 23:25:29 -0700

std.zig.ErrorBundle: add some explicit error sets

Diffstat:
Mlib/std/zig/ErrorBundle.zig | 14+++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/lib/std/zig/ErrorBundle.zig b/lib/std/zig/ErrorBundle.zig @@ -383,7 +383,7 @@ pub const Wip = struct { }; } - pub fn addString(wip: *Wip, s: []const u8) !u32 { + pub fn addString(wip: *Wip, s: []const u8) Allocator.Error!u32 { const gpa = wip.gpa; const index: u32 = @intCast(wip.string_bytes.items.len); try wip.string_bytes.ensureUnusedCapacity(gpa, s.len + 1); @@ -392,7 +392,7 @@ pub const Wip = struct { return index; } - pub fn printString(wip: *Wip, comptime fmt: []const u8, args: anytype) !u32 { + pub fn printString(wip: *Wip, comptime fmt: []const u8, args: anytype) Allocator.Error!u32 { const gpa = wip.gpa; const index: u32 = @intCast(wip.string_bytes.items.len); try wip.string_bytes.writer(gpa).print(fmt, args); @@ -400,12 +400,12 @@ pub const Wip = struct { return index; } - pub fn addRootErrorMessage(wip: *Wip, em: ErrorMessage) !void { + pub fn addRootErrorMessage(wip: *Wip, em: ErrorMessage) Allocator.Error!void { try wip.root_list.ensureUnusedCapacity(wip.gpa, 1); wip.root_list.appendAssumeCapacity(try addErrorMessage(wip, em)); } - pub fn addErrorMessage(wip: *Wip, em: ErrorMessage) !MessageIndex { + pub fn addErrorMessage(wip: *Wip, em: ErrorMessage) Allocator.Error!MessageIndex { return @enumFromInt(try addExtra(wip, em)); } @@ -413,15 +413,15 @@ pub const Wip = struct { return @enumFromInt(addExtraAssumeCapacity(wip, em)); } - pub fn addSourceLocation(wip: *Wip, sl: SourceLocation) !SourceLocationIndex { + pub fn addSourceLocation(wip: *Wip, sl: SourceLocation) Allocator.Error!SourceLocationIndex { return @enumFromInt(try addExtra(wip, sl)); } - pub fn addReferenceTrace(wip: *Wip, rt: ReferenceTrace) !void { + pub fn addReferenceTrace(wip: *Wip, rt: ReferenceTrace) Allocator.Error!void { _ = try addExtra(wip, rt); } - pub fn addBundleAsNotes(wip: *Wip, other: ErrorBundle) !void { + pub fn addBundleAsNotes(wip: *Wip, other: ErrorBundle) Allocator.Error!void { const gpa = wip.gpa; try wip.string_bytes.ensureUnusedCapacity(gpa, other.string_bytes.len);