aboutsummaryrefslogtreecommitdiff
path: root/lib/std/array_hash_map.zig
diff options
context:
space:
mode:
Diffstat (limited to 'lib/std/array_hash_map.zig')
-rw-r--r--lib/std/array_hash_map.zig10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/std/array_hash_map.zig b/lib/std/array_hash_map.zig
index 3ddaac49eb..e582f55819 100644
--- a/lib/std/array_hash_map.zig
+++ b/lib/std/array_hash_map.zig
@@ -77,12 +77,15 @@ pub fn ArrayHashMap(
comptime Context: type,
comptime store_hash: bool,
) type {
- comptime std.hash_map.verifyContext(Context, K, K, u32, true);
return struct {
unmanaged: Unmanaged,
allocator: Allocator,
ctx: Context,
+ comptime {
+ std.hash_map.verifyContext(Context, K, K, u32, true);
+ }
+
/// The ArrayHashMapUnmanaged type using the same settings as this managed map.
pub const Unmanaged = ArrayHashMapUnmanaged(K, V, Context, store_hash);
@@ -470,7 +473,6 @@ pub fn ArrayHashMapUnmanaged(
comptime Context: type,
comptime store_hash: bool,
) type {
- comptime std.hash_map.verifyContext(Context, K, K, u32, true);
return struct {
/// It is permitted to access this field directly.
entries: DataList = .{},
@@ -481,6 +483,10 @@ pub fn ArrayHashMapUnmanaged(
/// by how many total indexes there are.
index_header: ?*IndexHeader = null,
+ comptime {
+ std.hash_map.verifyContext(Context, K, K, u32, true);
+ }
+
/// Modifying the key is allowed only if it does not change the hash.
/// Modifying the value is allowed.
/// Entry pointers become invalid whenever this ArrayHashMap is modified,