2018-11-24 07:34:13 -06:00
|
|
|
// force-host
|
2017-03-17 18:41:09 -05:00
|
|
|
// no-prefer-dynamic
|
2017-01-15 18:54:36 -06:00
|
|
|
|
2017-03-17 18:41:09 -05:00
|
|
|
#![crate_type = "proc-macro"]
|
2020-01-31 16:02:31 -06:00
|
|
|
#![feature(proc_macro_quote)]
|
2017-01-15 18:54:36 -06:00
|
|
|
|
2017-03-17 18:41:09 -05:00
|
|
|
extern crate proc_macro;
|
2017-01-15 18:54:36 -06:00
|
|
|
|
2017-03-17 18:41:09 -05:00
|
|
|
use proc_macro::{TokenStream, quote};
|
2017-01-15 18:54:36 -06:00
|
|
|
|
|
|
|
// This macro is not very interesting, but it does contain delimited tokens with
|
|
|
|
// no content - `()` and `{}` - which has caused problems in the past.
|
2017-03-14 17:04:46 -05:00
|
|
|
// Also, it tests that we can escape `$` via `$$`.
|
2017-03-17 18:41:09 -05:00
|
|
|
#[proc_macro]
|
|
|
|
pub fn hello(_: TokenStream) -> TokenStream {
|
2017-03-14 17:04:46 -05:00
|
|
|
quote!({
|
|
|
|
fn hello() {}
|
|
|
|
macro_rules! m { ($$($$t:tt)*) => { $$($$t)* } }
|
|
|
|
m!(hello());
|
|
|
|
})
|
2017-01-15 18:54:36 -06:00
|
|
|
}
|