]>
Commit | Line | Data |
---|---|---|
f035d41b XL |
1 | // Check that default generics associated types are validated. |
2 | ||
3 | #![feature(specialization)] | |
4 | #![feature(generic_associated_types)] | |
5 | //~^^ WARNING `specialization` is incomplete | |
6 | //~^^ WARNING the feature `generic_associated_types` is incomplete | |
7 | ||
8 | trait X { | |
29967ef6 | 9 | type U<'a>: PartialEq<&'a Self> where Self: 'a; |
f035d41b XL |
10 | fn unsafe_compare<'b>(x: Option<Self::U<'b>>, y: Option<&'b Self>) { |
11 | match (x, y) { | |
12 | (Some(a), Some(b)) => a == b, | |
13 | _ => false, | |
14 | }; | |
15 | } | |
16 | } | |
17 | ||
18 | impl<T: 'static> X for T { | |
19 | default type U<'a> = &'a T; | |
20 | //~^ ERROR can't compare `T` with `T` | |
21 | } | |
22 | ||
23 | struct NotComparable; | |
24 | ||
25 | pub fn main() { | |
26 | <NotComparable as X>::unsafe_compare(None, None); | |
27 | } |