summaryrefslogtreecommitdiffstats
path: root/tests/ui/proc-macro/auxiliary/gen-macro-rules-hygiene.rs
blob: 548fefe76f57111a25c50726aa6c6e0500b0d3c9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// force-host
// no-prefer-dynamic

#![crate_type = "proc-macro"]

extern crate proc_macro;
use proc_macro::*;

#[proc_macro]
pub fn gen_macro_rules(_: TokenStream) -> TokenStream {
    "
    macro_rules! generated {() => {
        struct ItemDef;
        let local_def = 0;

        ItemUse; // OK
        local_use; // ERROR
        break 'label_use; // ERROR

        type DollarCrate = $crate::ItemUse; // OK
    }}
    ".parse().unwrap()
}