summary refs log tree commit diff
path: root/src/test/ui/proc-macro/group-compat-hack/group-compat-hack.rs
blob: 2b742771d6f2c7dede3574c71e7577bdd4747a5d (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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
// check-pass
// aux-build:pin-project-internal-0.4.0.rs
// compile-flags: -Z span-debug

#![no_std] // Don't load unnecessary hygiene information from std
extern crate std;

#[macro_use] extern crate group_compat_hack;

// Tests the backwards compatibility hack added for certain macros
// When an attribute macro named `proc_macro_hack` or `wasm_bindgen`
// has an `NtIdent` named `$name`, we pass a plain `Ident` token in
// place of a `None`-delimited group. This allows us to maintain
// backwards compatibility for older versions of these crates.

mod no_version {
    include!("js-sys/src/lib.rs");
    include!("time-macros-impl/src/lib.rs");

    macro_rules! other {
        ($name:ident) => {
            #[my_macro] struct Three($name);
        }
    }

    struct Foo;
    impl_macros!(Foo); //~ WARN  using an old version
                       //~| WARN this was previously
    arrays!(Foo);
    other!(Foo);
}

mod with_version {
    include!("js-sys-0.3.17/src/lib.rs");
    include!("time-macros-impl-0.1.0/src/lib.rs");

    macro_rules! other {
        ($name:ident) => {
            #[my_macro] struct Three($name);
        }
    }

    struct Foo;
    impl_macros!(Foo); //~  WARN using an old version
                       //~| WARN this was previously
    arrays!(Foo); //~  WARN using an old version
                  //~| WARN this was previously
    other!(Foo);
}

mod actix_web_test {
    include!("actix-web/src/extract.rs");

    struct Foo;
    tuple_from_req!(Foo); //~ WARN using an old version
    //~| WARN this was previously
}

mod actix_web_version_test {
    include!("actix-web-2.0.0/src/extract.rs");

    struct Foo;
    tuple_from_req!(Foo); //~ WARN using an old version
    //~| WARN this was previously
}

mod actori_web_test {
    include!("actori-web/src/extract.rs");

    struct Foo;
    tuple_from_req!(Foo);
}

mod actori_web_version_test {
    include!("actori-web-2.0.0/src/extract.rs");

    struct Foo;
    tuple_from_req!(Foo);
}

mod with_good_js_sys_version {
    include!("js-sys-0.3.40/src/lib.rs");
    struct Foo;
    arrays!(Foo);
}


fn main() {}