summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/tests/ui/auxiliary/macro_use_helper.rs
blob: ecb55d8cb48d5bbcb6f32ba3223d6ef8671793ed (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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
extern crate macro_rules;

// STMT
#[macro_export]
macro_rules! pub_macro {
    () => {
        let _ = "hello Mr. Vonnegut";
    };
}

pub mod inner {
    pub use super::*;

    // RE-EXPORT
    // this will stick in `inner` module
    pub use macro_rules::foofoo;
    pub use macro_rules::try_err;

    pub mod nested {
        pub use macro_rules::string_add;
    }

    // ITEM
    #[macro_export]
    macro_rules! inner_mod_macro {
        () => {
            #[allow(dead_code)]
            pub struct Tardis;
        };
    }
}

// EXPR
#[macro_export]
macro_rules! function_macro {
    () => {
        if true {
        } else {
        }
    };
}

// TYPE
#[macro_export]
macro_rules! ty_macro {
    () => {
        Vec<u8>
    };
}

mod extern_exports {
    pub(super) mod private_inner {
        #[macro_export]
        macro_rules! pub_in_private_macro {
            ($name:ident) => {
                let $name = String::from("secrets and lies");
            };
        }
    }
}