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 // check that trait matching can handle impls whose types are only
12 // constrained by a projection.
17 trait Mirror { type Image: ?Sized; }
18 impl<T
: ?Sized
> Mirror
for T { type Image = T; }
21 impl<U
: Mirror
, V
: Mirror
<Image
=L
>, L
: Mirror
<Image
=U
>> Bar
for V
22 where U
::Image
: IsU32 {}
24 trait Foo { fn name() -> &'static str; }
25 impl Foo
for u64 { fn name() -> &'static str { "u64" }
}
26 impl<T
: Bar
> Foo
for T { fn name() -> &'static str { "Bar" }
}
29 assert_eq
!(<u64 as Foo
>::name(), "u64");
30 assert_eq
!(<u32 as Foo
>::name(), "Bar");