rust/tests/ui/auxiliary/hello_macro.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

22 lines
547 B
Rust
Raw Normal View History

// 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.
2017-03-14 17:04:46 -05:00
// Also, it tests that we can escape `$` via `$$`.
#[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());
})
}