| ... | ... | @@ -17,6 +17,17 @@ const Allocator = mem.Allocator; |
| 17 | 17 | const Wyhash = std.hash.Wyhash; |
| 18 | 18 | |
| 19 | 19 | pub fn getAutoHashFn(comptime K: type) (fn (K) u64) { |
| 20 | comptime { |
| 21 | assert(@hasDecl(std, "StringHashMap")); // detect when the following message needs updated |
| 22 | if (K == []const u8) { |
| 23 | @compileError("std.auto_hash.autoHash does not allow slices here (" ++ |
| 24 | @typeName(K) ++ |
| 25 | ") because the intent is unclear. " ++ |
| 26 | "Consider using std.StringHashMap for hashing the contents of []const u8. " ++ |
| 27 | "Alternatively, consider using std.auto_hash.hash or providing your own hash function instead."); |
| 28 | } |
| 29 | } |
| 30 | |
| 20 | 31 | return struct { |
| 21 | 32 | fn hash(key: K) u64 { |
| 22 | 33 | if (comptime trait.hasUniqueRepresentation(K)) { |