fix error message when providing slice to std.hash.autoHash

This commit is contained in:
LordMZTE 2022-08-11 12:16:36 +02:00 committed by Veikka Tuominen
parent a82d7c2063
commit bbcc26a9b6

View File

@ -193,8 +193,8 @@ fn typeContainsSlice(comptime K: type) bool {
pub fn autoHash(hasher: anytype, key: anytype) void { pub fn autoHash(hasher: anytype, key: anytype) void {
const Key = @TypeOf(key); const Key = @TypeOf(key);
if (comptime typeContainsSlice(Key)) { if (comptime typeContainsSlice(Key)) {
@compileError("std.auto_hash.autoHash does not allow slices as well as unions and structs containing slices here (" ++ @typeName(Key) ++ @compileError("std.hash.autoHash does not allow slices as well as unions and structs containing slices here (" ++ @typeName(Key) ++
") because the intent is unclear. Consider using std.auto_hash.hash or providing your own hash function instead."); ") because the intent is unclear. Consider using std.hash.autoHashStrat or providing your own hash function instead.");
} }
hash(hasher, key, .Shallow); hash(hasher, key, .Shallow);