authorgravatar for jarred@jarredsumner.comJarred Sumner <jarred@jarredsumner.com> 2022-01-16 17:26:49-08:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2022-01-16 17:26:49-08:00
log144e36770ed7d7e1ddbcae61742cf76bfb8b0e41
tree0e34dba84197758bc67c69d52f5eab40530ad636
parent97063efb69d11bfe7210555948b1f59ab6fb9d08
signaturebadge-question-mark Signed by PGP key 4AEE18F83AFDEB23

Fix missing `!void` in std.MultiArrayList

Calling `insert` on a `std.MultiArrayList` currently fails with a compiler error due to using a `try` without the `!` annotation on the return type ```zig this.list.insert(allocator, 0, listener); ``` ```zig /Users/jarred/Build/zig/lib/std/multi_array_list.zig:192:13: error: expected type 'void', found '@typeInfo(@typeInfo(@TypeOf(std.multi_array_list.MultiArrayList(src.javascript.jsc.node.types.Listener).ensureUnusedCapacity)).Fn.return_type.?).ErrorUnion.error_set' try self.ensureUnusedCapacity(gpa, 1); ```

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

lib/std/multi_array_list.zig+1-1
...@@ -188,7 +188,7 @@ pub fn MultiArrayList(comptime S: type) type {...@@ -188,7 +188,7 @@ pub fn MultiArrayList(comptime S: type) type {
188 /// after and including the specified index back by one and188 /// after and including the specified index back by one and
189 /// sets the given index to the specified element. May reallocate189 /// sets the given index to the specified element. May reallocate
190 /// and invalidate iterators.190 /// and invalidate iterators.
191 pub fn insert(self: *Self, gpa: Allocator, index: usize, elem: S) void {191 pub fn insert(self: *Self, gpa: Allocator, index: usize, elem: S) !void {
192 try self.ensureUnusedCapacity(gpa, 1);192 try self.ensureUnusedCapacity(gpa, 1);
193 self.insertAssumeCapacity(index, elem);193 self.insertAssumeCapacity(index, elem);
194 }194 }