You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
error: unable to infer enough type information to locate the impl of the trait `collections::hash::Hash` for the type `_`; type annotations required
#[deriving(Hash)]
^~~~
This compiles because 1 is now 1i32. It still hashes 1 for A and 1us for B, thus causes collision on 32-bit machine:
use std::hash::{hash,SipHasher};#[derive(Hash)]enumE{A = 1,B,}fnmain(){let a = hash::<_,SipHasher>(&E::A);let b = hash::<_,SipHasher>(&E::B);println!("{}, {}, {}", a, b, a == b);}
rustc --pretty=expanded
output:For
A = 1,
rustc generates1.hash(__arg_0)
but it doesn't compile because1
is generic integer.Moreoever, for
B
rustc generates1u.hash(__arg_0)
but it should be2u
.The text was updated successfully, but these errors were encountered: