summaryrefslogtreecommitdiffstats
path: root/tests/ui/auxiliary/hello_macro.rs
blob: a05b8d54dc10ea75ac19ead4077d8a670045d3a5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// force-host
// no-prefer-dynamic

#![crate_type = "proc-macro"]
#![feature(proc_macro_quote)]

extern crate proc_macro;

use proc_macro::{TokenStream, quote};

// This macro is not very interesting, but it does contain delimited tokens with
// no content - `()` and `{}` - which has caused problems in the past.
// Also, it tests that we can escape `$` via `$$`.
#[proc_macro]
pub fn hello(_: TokenStream) -> TokenStream {
    quote!({
        fn hello() {}
        macro_rules! m { ($$($$t:tt)*) => { $$($$t)* } }
        m!(hello());
    })
}