rust/tests/ui/proc-macro/auxiliary/gen-macro-rules-hygiene.rs
2023-01-11 09:32:08 +00:00

24 lines
445 B
Rust

// 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()
}