]> git.proxmox.com Git - rustc.git/blame - src/test/run-pass/proc-macro/crate-var.rs
New upstream version 1.37.0+dfsg1
[rustc.git] / src / test / run-pass / proc-macro / crate-var.rs
CommitLineData
476ff2be 1// aux-build:double.rs
94b46f34 2// aux-build:external-crate-var.rs
1a4d82fc 3
476ff2be
SL
4#![allow(unused)]
5
6#[macro_use]
7extern crate double;
94b46f34
XL
8#[macro_use]
9extern crate external_crate_var;
476ff2be
SL
10
11struct Foo;
12
94b46f34
XL
13trait Trait {
14 const CONST: u32;
15 type Assoc;
16}
17
18impl Trait for Foo {
19 const CONST: u32 = 0;
20 type Assoc = Foo;
21}
22
23macro_rules! local { () => {
24 // derive_Double outputs secondary copies of each definition
25 // to test what the proc_macro sees.
26 mod bar {
27 #[derive(Double)]
28 struct Bar($crate::Foo);
29 }
30
31 mod qself {
32 #[derive(Double)]
33 struct QSelf(<::Foo as $crate::Trait>::Assoc);
34 }
35
36 mod qself_recurse {
37 #[derive(Double)]
38 struct QSelfRecurse(<<$crate::Foo as $crate::Trait>::Assoc as $crate::Trait>::Assoc);
39 }
40
41 mod qself_in_const {
42 #[derive(Double)]
43 #[repr(u32)]
44 enum QSelfInConst {
45 Variant = <::Foo as $crate::Trait>::CONST,
46 }
47 }
476ff2be 48} }
94b46f34
XL
49
50mod local {
51 local!();
52}
53
54// and now repeat the above tests, using a macro defined in another crate
55
56mod external {
57 external!{}
58}
9e0c209e
SL
59
60fn main() {}