summaryrefslogtreecommitdiffstats
path: root/tests/ui/specialization/min_specialization/specialize-associated-type.rs
blob: c4960b0c28e786227d2ff8940216b9ba80f090e3 (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
31
32
33
34
35
36
37
// Another regression test for #109815.

// check-pass

#![feature(min_specialization)]
#![feature(rustc_attrs)]

#[rustc_specialization_trait]
trait X {}
trait Z {
    type Assoc: X;
}
struct A<T>(T);

impl X for () {}

impl<T: X> Z for A<T> {
    type Assoc = ();
}

trait MyFrom<T> {
    fn from(other: T) -> Self;
}

impl<T> MyFrom<()> for T {
    default fn from(other: ()) -> T {
        panic!();
    }
}

impl<T: X> MyFrom<<A<T> as Z>::Assoc> for T {
    fn from(other: ()) -> T {
        panic!();
    }
}

fn main() {}