summaryrefslogtreecommitdiffstats
path: root/src/test/ui/proc-macro/auxiliary/external-crate-var.rs
blob: 4319e921225e0c370e5fc2a06167e240ad13e971 (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
38
39
40
pub struct ExternFoo;

pub trait ExternTrait {
    const CONST: u32;
    type Assoc;
}

impl ExternTrait for ExternFoo {
    const CONST: u32 = 0;
    type Assoc = ExternFoo;
}

#[macro_export]
macro_rules! external { () => {
    mod bar {
        #[derive(Double)]
        struct Bar($crate::ExternFoo);
    }

    mod qself {
        #[derive(Double)]
        struct QSelf(<$crate::ExternFoo as $crate::ExternTrait>::Assoc);
    }

    mod qself_recurse {
        #[derive(Double)]
        struct QSelfRecurse(<
            <$crate::ExternFoo as $crate::ExternTrait>::Assoc
            as $crate::ExternTrait>::Assoc
        );
    }

    mod qself_in_const {
        #[derive(Double)]
        #[repr(u32)]
        enum QSelfInConst {
            Variant = <$crate::ExternFoo as $crate::ExternTrait>::CONST,
        }
    }
} }