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