summaryrefslogtreecommitdiffstats
path: root/tests/ui/hygiene/assoc_ty_bindings.rs
blob: a786127493298a7eee2f951f7577ccd60bcc834d (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
// check-pass

#![feature(decl_macro, associated_type_defaults)]

trait Base {
    type AssocTy;
    fn f();
}
trait Derived: Base {
    fn g();
}

macro mac() {
    type A = dyn Base<AssocTy = u8>;
    type B = dyn Derived<AssocTy = u8>;

    impl Base for u8 {
        type AssocTy = u8;
        fn f() {
            let _: Self::AssocTy;
        }
    }
    impl Derived for u8 {
        fn g() {
            let _: Self::AssocTy;
        }
    }

    fn h<T: Base, U: Derived>() {
        let _: T::AssocTy;
        let _: U::AssocTy;
    }
}

mac!();

fn main() {}