| ... | ... | @@ -529,10 +529,6 @@ pub fn ArrayHashMapUnmanaged( |
| 529 | 529 | /// Used to detect memory safety violations. |
| 530 | 530 | pointer_stability: std.debug.SafetyLock = .{}, |
| 531 | 531 | |
| 532 | | comptime { |
| 533 | | std.hash_map.verifyContext(Context, K, K, u32, true); |
| 534 | | } |
| 535 | | |
| 536 | 532 | /// Modifying the key is allowed only if it does not change the hash. |
| 537 | 533 | /// Modifying the value is allowed. |
| 538 | 534 | /// Entry pointers become invalid whenever this ArrayHashMap is modified, |
| ... | ... | @@ -1847,27 +1843,16 @@ pub fn ArrayHashMapUnmanaged( |
| 1847 | 1843 | } |
| 1848 | 1844 | } |
| 1849 | 1845 | |
| 1850 | | inline fn checkedHash(ctx: anytype, key: anytype) u32 { |
| 1851 | | comptime std.hash_map.verifyContext(@TypeOf(ctx), @TypeOf(key), K, u32, true); |
| 1846 | fn checkedHash(ctx: anytype, key: anytype) u32 { |
| 1852 | 1847 | // If you get a compile error on the next line, it means that your |
| 1853 | 1848 | // generic hash function doesn't accept your key. |
| 1854 | | const hash = ctx.hash(key); |
| 1855 | | if (@TypeOf(hash) != u32) { |
| 1856 | | @compileError("Context " ++ @typeName(@TypeOf(ctx)) ++ " has a generic hash function that returns the wrong type!\n" ++ |
| 1857 | | @typeName(u32) ++ " was expected, but found " ++ @typeName(@TypeOf(hash))); |
| 1858 | | } |
| 1859 | | return hash; |
| 1849 | return ctx.hash(key); |
| 1860 | 1850 | } |
| 1861 | | inline fn checkedEql(ctx: anytype, a: anytype, b: K, b_index: usize) bool { |
| 1862 | | comptime std.hash_map.verifyContext(@TypeOf(ctx), @TypeOf(a), K, u32, true); |
| 1851 | |
| 1852 | fn checkedEql(ctx: anytype, a: anytype, b: K, b_index: usize) bool { |
| 1863 | 1853 | // If you get a compile error on the next line, it means that your |
| 1864 | 1854 | // generic eql function doesn't accept (self, adapt key, K, index). |
| 1865 | | const eql = ctx.eql(a, b, b_index); |
| 1866 | | if (@TypeOf(eql) != bool) { |
| 1867 | | @compileError("Context " ++ @typeName(@TypeOf(ctx)) ++ " has a generic eql function that returns the wrong type!\n" ++ |
| 1868 | | @typeName(bool) ++ " was expected, but found " ++ @typeName(@TypeOf(eql))); |
| 1869 | | } |
| 1870 | | return eql; |
| 1855 | return ctx.eql(a, b, b_index); |
| 1871 | 1856 | } |
| 1872 | 1857 | |
| 1873 | 1858 | fn dumpState(self: Self, comptime keyFmt: []const u8, comptime valueFmt: []const u8) void { |