`unique(Vector{CustomStruct})` requires method for hash | Bug or misleading documentation?

This is documented in the docs for isequal:

isequal is the comparison function used by hash tables (Dict). isequal(x,y) must imply that hash(x)
== hash(y)

, as well as in the docs of hash. But yes, this invariant is a little to easy to forget, for which there is an old issue: custom hashing is too easy to accidentally break · Issue #12198 · JuliaLang/julia · GitHub

2 Likes