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 {...@@ -383,7 +383,7 @@ pub const Wip = struct {
383 };383 };
384 }384 }
385385
386 pub fn addString(wip: *Wip, s: []const u8) !u32 {386 pub fn addString(wip: *Wip, s: []const u8) Allocator.Error!u32 {
387 const gpa = wip.gpa;387 const gpa = wip.gpa;
388 const index: u32 = @intCast(wip.string_bytes.items.len);388 const index: u32 = @intCast(wip.string_bytes.items.len);
389 try wip.string_bytes.ensureUnusedCapacity(gpa, s.len + 1);389 try wip.string_bytes.ensureUnusedCapacity(gpa, s.len + 1);
...@@ -392,7 +392,7 @@ pub const Wip = struct {...@@ -392,7 +392,7 @@ pub const Wip = struct {
392 return index;392 return index;
393 }393 }
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 {
396 const gpa = wip.gpa;396 const gpa = wip.gpa;
397 const index: u32 = @intCast(wip.string_bytes.items.len);397 const index: u32 = @intCast(wip.string_bytes.items.len);
398 try wip.string_bytes.writer(gpa).print(fmt, args);398 try wip.string_bytes.writer(gpa).print(fmt, args);
...@@ -400,12 +400,12 @@ pub const Wip = struct {...@@ -400,12 +400,12 @@ pub const Wip = struct {
400 return index;400 return index;
401 }401 }
402402
403 pub fn addRootErrorMessage(wip: *Wip, em: ErrorMessage) !void {403 pub fn addRootErrorMessage(wip: *Wip, em: ErrorMessage) Allocator.Error!void {
404 try wip.root_list.ensureUnusedCapacity(wip.gpa, 1);404 try wip.root_list.ensureUnusedCapacity(wip.gpa, 1);
405 wip.root_list.appendAssumeCapacity(try addErrorMessage(wip, em));405 wip.root_list.appendAssumeCapacity(try addErrorMessage(wip, em));
406 }406 }
407407
408 pub fn addErrorMessage(wip: *Wip, em: ErrorMessage) !MessageIndex {408 pub fn addErrorMessage(wip: *Wip, em: ErrorMessage) Allocator.Error!MessageIndex {
409 return @enumFromInt(try addExtra(wip, em));409 return @enumFromInt(try addExtra(wip, em));
410 }410 }
411411
...@@ -413,15 +413,15 @@ pub const Wip = struct {...@@ -413,15 +413,15 @@ pub const Wip = struct {
413 return @enumFromInt(addExtraAssumeCapacity(wip, em));413 return @enumFromInt(addExtraAssumeCapacity(wip, em));
414 }414 }
415415
416 pub fn addSourceLocation(wip: *Wip, sl: SourceLocation) !SourceLocationIndex {416 pub fn addSourceLocation(wip: *Wip, sl: SourceLocation) Allocator.Error!SourceLocationIndex {
417 return @enumFromInt(try addExtra(wip, sl));417 return @enumFromInt(try addExtra(wip, sl));
418 }418 }
419419
420 pub fn addReferenceTrace(wip: *Wip, rt: ReferenceTrace) !void {420 pub fn addReferenceTrace(wip: *Wip, rt: ReferenceTrace) Allocator.Error!void {
421 _ = try addExtra(wip, rt);421 _ = try addExtra(wip, rt);
422 }422 }
423423
424 pub fn addBundleAsNotes(wip: *Wip, other: ErrorBundle) !void {424 pub fn addBundleAsNotes(wip: *Wip, other: ErrorBundle) Allocator.Error!void {
425 const gpa = wip.gpa;425 const gpa = wip.gpa;
426426
427 try wip.string_bytes.ensureUnusedCapacity(gpa, other.string_bytes.len);427 try wip.string_bytes.ensureUnusedCapacity(gpa, other.string_bytes.len);