diff options
| author | Jarred Sumner <jarred@jarredsumner.com> | 2022-01-16 17:26:49 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-01-16 17:26:49 -0800 |
| commit | 144e36770ed7d7e1ddbcae61742cf76bfb8b0e41 (patch) | |
| tree | 0e34dba84197758bc67c69d52f5eab40530ad636 /lib/std/multi_array_list.zig | |
| parent | 97063efb69d11bfe7210555948b1f59ab6fb9d08 (diff) | |
| download | zig-144e36770ed7d7e1ddbcae61742cf76bfb8b0e41.tar.gz zig-144e36770ed7d7e1ddbcae61742cf76bfb8b0e41.zip | |
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);
```
Diffstat (limited to 'lib/std/multi_array_list.zig')
| -rw-r--r-- | lib/std/multi_array_list.zig | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/std/multi_array_list.zig b/lib/std/multi_array_list.zig index a651076aba..7195aef55a 100644 --- a/lib/std/multi_array_list.zig +++ b/lib/std/multi_array_list.zig @@ -188,7 +188,7 @@ pub fn MultiArrayList(comptime S: type) type { /// after and including the specified index back by one and /// sets the given index to the specified element. May reallocate /// and invalidate iterators. - pub fn insert(self: *Self, gpa: Allocator, index: usize, elem: S) void { + pub fn insert(self: *Self, gpa: Allocator, index: usize, elem: S) !void { try self.ensureUnusedCapacity(gpa, 1); self.insertAssumeCapacity(index, elem); } |
