rust-lang/rust

`Hash::hash`'s type parameter should be `?Sized`

apasel422 opened this issue · 3 comments

The Hasher trait is not Sized, but Hash::hash is defined to take a sized type parameter. This prevents code like the following from working:

use std::hash::{Hash, Hasher};

fn bar(hasher: &mut Hasher) {
    1.hash(hasher);
}

fn main() {}

Changing this now would be a breaking change, however, as all manual implementors would need to be updated.

If this requires changing all implementors I think our hands may unfortunately be tied on this one

Yeah, I guess this isn't going to be possible.