That’s not broken, there is absolutely nothing guaranteeing that two different values hash to a different value,
impl Hash for f32 {
fn hash<H>(&self, state: &mut H) where H: Hasher {
state.write_u8(4);
}
}
is a 100% valid implementation of Hash for f32.
If a type implements Eq then the contract for Hash states that it must satisfy if x == y: hash(x) == hash(y), but there are no other constraints on Hash.
If you care about +0 and -0 behaving differently you must check that yourself after receiving a matching hashed value. In that case you can’t use == directly on the f32 value since -0.0 == 0.0 is true, you will have to define your own equality comparison and use that instead.