mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-27 17:24:06 +00:00
22 lines
547 B
Rust
22 lines
547 B
Rust
// 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());
|
|
})
|
|
}
|