External Publication
Visit Post

The Hashtable Problem: A Litmus Test for External Impl Proposals

Rust Internals [Unofficial] June 18, 2026
Source

ais523:

  • Hash is a safe trait, so nothing forces K: Hash and &K: Hash to have any relationship to each other, but it is possible to add keys to a hash as K and then retrieve them using an &K;

Doesn't really make a difference, but this isn't true. The standard library itself provides

impl<T> Hash for &T
where
    T: Hash + ?Sized,

So nobody else can provide different impls for K and &K, that would conflict.

Discussion in the ATmosphere

Loading comments...