1 // Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 // Test that we handle projection types which wind up important for
12 // resolving methods. This test was reduced from a larger example; the
13 // call to `foo()` at the end was failing to resolve because the
14 // winnowing stage of method resolution failed to handle an associated
17 #![feature(associated_types)]
21 fn finish(&self) -> Self::Output;
24 trait Hash<H: Hasher> {
25 fn hash(&self, h: &mut H);
30 fn hasher(&self) -> Self::Wut;
34 impl Hasher for SipHasher {
36 fn finish(&self) -> u64 { 4 }
39 impl Hash<SipHasher> for int {
40 fn hash(&self, h: &mut SipHasher) {}
44 impl HashState for SipState {
46 fn hasher(&self) -> SipHasher { SipHasher }
55 <S as HashState>::Wut: Hasher<Output=u64>,
57 fn foo<K>(&self, k: K) where K: Hash< <S as HashState>::Wut> {}
60 fn foo<K: Hash<SipHasher>>(map: &Map<SipState>) {