authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-10-03 23:25:29-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-10-08 16:54:30-07:00
log24c8adc6ac40e5b73ae0caee0c559c008467d63a
tree948aec55e7c383ea7a68c2b319dbe1164c420ed6
parent51e15a9650d4634d7d228617fc2aea3ecc2ed073

std.zig.ErrorBundle: add some explicit error sets


1 files changed, 7 insertions(+), 7 deletions(-)

lib/std/zig/ErrorBundle.zig+7-7
......@@ -383,7 +383,7 @@ pub const Wip = struct {
383383 };
384384 }
385385
386 pub fn addString(wip: *Wip, s: []const u8) !u32 {
386 pub fn addString(wip: *Wip, s: []const u8) Allocator.Error!u32 {
387387 const gpa = wip.gpa;
388388 const index: u32 = @intCast(wip.string_bytes.items.len);
389389 try wip.string_bytes.ensureUnusedCapacity(gpa, s.len + 1);
......@@ -392,7 +392,7 @@ pub const Wip = struct {
392392 return index;
393393 }
394394
395 pub fn printString(wip: *Wip, comptime fmt: []const u8, args: anytype) !u32 {
395 pub fn printString(wip: *Wip, comptime fmt: []const u8, args: anytype) Allocator.Error!u32 {
396396 const gpa = wip.gpa;
397397 const index: u32 = @intCast(wip.string_bytes.items.len);
398398 try wip.string_bytes.writer(gpa).print(fmt, args);
......@@ -400,12 +400,12 @@ pub const Wip = struct {
400400 return index;
401401 }
402402
403 pub fn addRootErrorMessage(wip: *Wip, em: ErrorMessage) !void {
403 pub fn addRootErrorMessage(wip: *Wip, em: ErrorMessage) Allocator.Error!void {
404404 try wip.root_list.ensureUnusedCapacity(wip.gpa, 1);
405405 wip.root_list.appendAssumeCapacity(try addErrorMessage(wip, em));
406406 }
407407
408 pub fn addErrorMessage(wip: *Wip, em: ErrorMessage) !MessageIndex {
408 pub fn addErrorMessage(wip: *Wip, em: ErrorMessage) Allocator.Error!MessageIndex {
409409 return @enumFromInt(try addExtra(wip, em));
410410 }
411411
......@@ -413,15 +413,15 @@ pub const Wip = struct {
413413 return @enumFromInt(addExtraAssumeCapacity(wip, em));
414414 }
415415
416 pub fn addSourceLocation(wip: *Wip, sl: SourceLocation) !SourceLocationIndex {
416 pub fn addSourceLocation(wip: *Wip, sl: SourceLocation) Allocator.Error!SourceLocationIndex {
417417 return @enumFromInt(try addExtra(wip, sl));
418418 }
419419
420 pub fn addReferenceTrace(wip: *Wip, rt: ReferenceTrace) !void {
420 pub fn addReferenceTrace(wip: *Wip, rt: ReferenceTrace) Allocator.Error!void {
421421 _ = try addExtra(wip, rt);
422422 }
423423
424 pub fn addBundleAsNotes(wip: *Wip, other: ErrorBundle) !void {
424 pub fn addBundleAsNotes(wip: *Wip, other: ErrorBundle) Allocator.Error!void {
425425 const gpa = wip.gpa;
426426
427427 try wip.string_bytes.ensureUnusedCapacity(gpa, other.string_bytes.len);