summaryrefslogtreecommitdiffstats
path: root/src/test/ui/specialization/min_specialization/implcit-well-formed-bounds.rs
blob: 98d7f9194351c078e6696e7bb5ae14b8e8b81d81 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// Test that specializing on the well-formed predicates of the trait and
// self-type of an impl is allowed.

// check-pass

#![feature(min_specialization)]

struct OrdOnly<T: Ord>(T);

trait SpecTrait<U> {
    fn f();
}

impl<T, U> SpecTrait<U> for T {
    default fn f() {}
}

impl<T: Ord> SpecTrait<()> for OrdOnly<T> {
    fn f() {}
}

impl<T: Ord> SpecTrait<OrdOnly<T>> for () {
    fn f() {}
}

impl<T: Ord, U: Ord, V: Ord> SpecTrait<(OrdOnly<T>, OrdOnly<U>)> for &[OrdOnly<V>] {
    fn f() {}
}

fn main() {}