]> git.lizzy.rs Git - rust.git/blob - src/test/ui/specialization/deafult-generic-associated-type-bound.rs
Move `{core,std}::stream::Stream` to `{core,std}::async_iter::AsyncIterator`.
[rust.git] / src / test / ui / specialization / deafult-generic-associated-type-bound.rs
1 // Check that default generics associated types are validated.
2
3 #![feature(specialization)]
4 #![feature(generic_associated_types)]
5 //~^^ WARNING `specialization` is incomplete
6
7 trait X {
8     type U<'a>: PartialEq<&'a Self> where Self: 'a;
9     fn unsafe_compare<'b>(x: Option<Self::U<'b>>, y: Option<&'b Self>) {
10         match (x, y) {
11             (Some(a), Some(b)) => a == b,
12             _ => false,
13         };
14     }
15 }
16
17 impl<T: 'static> X for T {
18     default type U<'a> = &'a T;
19     //~^ ERROR can't compare `T` with `T`
20 }
21
22 struct NotComparable;
23
24 pub fn main() {
25     <NotComparable as X>::unsafe_compare(None, None);
26 }