mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 13:54:21 +00:00
std: fix missing hash map safety
There was a missing compile error for calling ensureUnusedCapacity without a Context in the case that the Context is non-void.
This commit is contained in:
parent
99112b63bd
commit
4f527e5d36
2 changed files with 3 additions and 1 deletions
|
|
@ -798,7 +798,7 @@ pub fn ArrayHashMapUnmanaged(
|
|||
allocator: Allocator,
|
||||
additional_capacity: usize,
|
||||
) !void {
|
||||
if (@sizeOf(ByIndexContext) != 0)
|
||||
if (@sizeOf(Context) != 0)
|
||||
@compileError("Cannot infer context " ++ @typeName(Context) ++ ", call ensureTotalCapacityContext instead.");
|
||||
return self.ensureUnusedCapacityContext(allocator, additional_capacity, undefined);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -913,6 +913,8 @@ pub fn HashMapUnmanaged(
|
|||
}
|
||||
|
||||
pub fn ensureUnusedCapacity(self: *Self, allocator: Allocator, additional_size: Size) Allocator.Error!void {
|
||||
if (@sizeOf(Context) != 0)
|
||||
@compileError("Cannot infer context " ++ @typeName(Context) ++ ", call ensureUnusedCapacityContext instead.");
|
||||
return ensureUnusedCapacityContext(self, allocator, additional_size, undefined);
|
||||
}
|
||||
pub fn ensureUnusedCapacityContext(self: *Self, allocator: Allocator, additional_size: Size, ctx: Context) Allocator.Error!void {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue