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