]> git.lizzy.rs Git - rust.git/blob - src/test/ui/specialization/defaultimpl/overlap-projection.rs
ed38bb3fc3a12e36a39f679cf3988443afe17c6b
[rust.git] / src / test / ui / specialization / defaultimpl / overlap-projection.rs
1 // run-pass
2
3 // Test that impls on projected self types can resolve overlap, even when the
4 // projections involve specialization, so long as the associated type is
5 // provided by the most specialized impl.
6
7 #![feature(specialization)]
8
9 trait Assoc {
10     type Output;
11 }
12
13 default impl<T> Assoc for T {
14     type Output = bool;
15 }
16
17 impl Assoc for u8 { type Output = u8; }
18 impl Assoc for u16 { type Output = u16; }
19
20 trait Foo {}
21 impl Foo for u32 {}
22 impl Foo for <u8 as Assoc>::Output {}
23 impl Foo for <u16 as Assoc>::Output {}
24
25 fn main() {}