mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 06:13:07 +00:00
fix error message when providing slice to std.hash.autoHash
This commit is contained in:
parent
a82d7c2063
commit
bbcc26a9b6
@ -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);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user