enforce HashMap to use TotalEq

discussed in #5283 and #4510
Seemed pretty straightforard, can anyone give it a look?