about summary refs log tree commit diff
path: root/tests/ui/lint/non-local-defs/macro_rules.rs
blob: ed30a24903d0172b68ee19e0c39019283c4ad3a3 (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
//@ check-pass
//@ edition:2021
//@ aux-build:non_local_macro.rs
//@ rustc-env:CARGO_CRATE_NAME=non_local_def

extern crate non_local_macro;

const B: u32 = {
    #[macro_export]
    macro_rules! m0 { () => { } };
    //~^ WARN non-local `macro_rules!` definition

    1
};

non_local_macro::non_local_macro_rules!(my_macro);
//~^ WARN non-local `macro_rules!` definition

fn main() {
    #[macro_export]
    macro_rules! m { () => { } };
    //~^ WARN non-local `macro_rules!` definition

    struct InsideMain;

    impl InsideMain {
        fn bar() {
            #[macro_export]
            macro_rules! m2 { () => { } };
            //~^ WARN non-local `macro_rules!` definition
        }
    }
}