summaryrefslogtreecommitdiffstats
path: root/src/test/ui/specialization/default-associated-type-bound-2.rs
blob: 0a21b1f09106ba36feeef0cd479eb277603586ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// Check that generic predicates are also checked for default associated types.
#![feature(specialization)]
//~^ WARNING `specialization` is incomplete

trait X<T> {
    type U: PartialEq<T>;
    fn unsafe_compare(x: Option<Self::U>, y: Option<T>) {
        match (x, y) {
            (Some(a), Some(b)) => a == b,
            _ => false,
        };
    }
}

impl<B: 'static, T> X<B> for T {
    default type U = &'static B;
    //~^ ERROR can't compare `&'static B` with `B`
}

pub fn main() {
    <i32 as X<i32>>::unsafe_compare(None, None);
}