]> git.lizzy.rs Git - rust.git/blob - src/test/ui/specialization/default-associated-type-bound-2.rs
Rollup merge of #105843 - compiler-errors:sugg-const, r=lcnr
[rust.git] / src / test / ui / specialization / default-associated-type-bound-2.rs
1 // Check that generic predicates are also checked for default associated types.
2 #![feature(specialization)]
3 //~^ WARNING `specialization` is incomplete
4
5 trait X<T> {
6     type U: PartialEq<T>;
7     fn unsafe_compare(x: Option<Self::U>, y: Option<T>) {
8         match (x, y) {
9             (Some(a), Some(b)) => a == b,
10             _ => false,
11         };
12     }
13 }
14
15 impl<B: 'static, T> X<B> for T {
16     default type U = &'static B;
17     //~^ ERROR can't compare `&'static B` with `B`
18 }
19
20 pub fn main() {
21     <i32 as X<i32>>::unsafe_compare(None, None);
22 }