2018-11-24 13:34:13 +00:00
|
|
|
//@ force-host
|
2017-03-17 23:41:09 +00:00
|
|
|
//@ no-prefer-dynamic
|
2017-01-16 00:54:36 +00:00
|
|
|
|
2017-03-17 23:41:09 +00:00
|
|
|
#![crate_type = "proc-macro"]
|
2020-01-31 22:02:31 +00:00
|
|
|
#![feature(proc_macro_quote)]
|
2017-01-16 00:54:36 +00:00
|
|
|
|
2017-03-17 23:41:09 +00:00
|
|
|
extern crate proc_macro;
|
2017-01-16 00:54:36 +00:00
|
|
|
|
2017-03-17 23:41:09 +00:00
|
|
|
use proc_macro::{TokenStream, quote};
|
2017-01-16 00:54:36 +00: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 22:04:46 +00:00
|
|
|
// Also, it tests that we can escape `$` via `$$`.
|
2017-03-17 23:41:09 +00:00
|
|
|
#[proc_macro]
|
|
|
|
pub fn hello(_: TokenStream) -> TokenStream {
|
2017-03-14 22:04:46 +00:00
|
|
|
quote!({
|
|
|
|
fn hello() {}
|
|
|
|
macro_rules! m { ($$($$t:tt)*) => { $$($$t)* } }
|
|
|
|
m!(hello());
|
|
|
|
})
|
2017-01-16 00:54:36 +00:00
|
|
|
}
|