Closed
Description
#[deriving(Hash)]
enum E {
A = 1,
B,
}
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)]
^~~~
rustc --pretty=expanded
output:
#![crate_type = "lib"]
#![feature(phase)]
#![no_std]
#![feature(globs)]
#[phase(plugin, link)]
extern crate "std" as std;
#[prelude_import]
use std::prelude::*;
enum E { A = 1, B, }
#[automatically_derived]
impl ::std::hash::Hash for E {
#[inline]
fn hash(&self, __arg_0: &mut ::std::hash::sip::SipState) {
match (&*self,) {
(&A,) => { 1.hash(__arg_0); }
(&B,) => { 1u.hash(__arg_0); }
}
}
}
For A = 1,
rustc generates 1.hash(__arg_0)
but it doesn't compile because 1
is generic integer.
Moreoever, for B
rustc generates 1u.hash(__arg_0)
but it should be 2u
.
Metadata
Metadata
Assignees
Labels
No labels