News for hackers. Stuff that matters.
Re:Go 1.21 may have a clear(x) builtin by tialaramex on Saturday November 19, 2022 @06:58PM (#33676403)
If your key type K doesn't obey the rules explained in HashMap ("if two keys are equal, their hashes must be equal") then Rust doesn't promise HashMap<K,V>'s functions will do something useful (although it will still be safe if your type is safe). So no this isn't a license to put silly things in hash maps. Non-useful but safe consequences might include spinning indefinitely.

But if you have put something daft in a hash map, drain() should definitely get it back out, so there's that.

There are no comments on this comment yet.