1 // Test an example where we fail to infer the type parameter H. This
2 // is because there is really nothing constraining it. At one time, we
3 // would infer based on the where clauses in scope, but that no longer
7 fn hash2(&self, hasher: &H) -> u64;
11 fn input(&mut self, bytes: &[u8]);
12 fn result(&self) -> u64;
17 fn stream(&self) -> Self::S;
20 trait StreamHash<H: StreamHasher>: Hash<H> {
21 fn input_stream(&self, stream: &mut H::S);
24 impl<H: StreamHasher> Hash<H> for u8 {
25 fn hash2(&self, hasher: &H) -> u64 {
26 let mut stream = hasher.stream();
27 self.input_stream(&mut stream); //~ ERROR type annotations needed
28 Stream::result(&stream)
32 impl<H: StreamHasher> StreamHash<H> for u8 {
33 fn input_stream(&self, stream: &mut H::S) {
34 Stream::input(stream, &[*self]);