]>
Commit | Line | Data |
---|---|---|
32a655c1 SL |
1 | // Copyright 2017 The Rust Project Developers. See the COPYRIGHT |
2 | // file at the top-level directory of this distribution and at | |
3 | // http://rust-lang.org/COPYRIGHT. | |
4 | // | |
5 | // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | |
6 | // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | |
7 | // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | |
8 | // option. This file may not be copied, modified, or distributed | |
9 | // except according to those terms. | |
10 | ||
041b39d2 | 11 | // no-prefer-dynamic |
32a655c1 | 12 | |
041b39d2 | 13 | #![crate_type = "proc-macro"] |
94b46f34 | 14 | #![feature(proc_macro, proc_macro_non_items)] |
32a655c1 | 15 | |
041b39d2 | 16 | extern crate proc_macro; |
32a655c1 | 17 | |
041b39d2 | 18 | use proc_macro::{TokenStream, quote}; |
32a655c1 SL |
19 | |
20 | // This macro is not very interesting, but it does contain delimited tokens with | |
21 | // no content - `()` and `{}` - which has caused problems in the past. | |
cc61c64b | 22 | // Also, it tests that we can escape `$` via `$$`. |
041b39d2 XL |
23 | #[proc_macro] |
24 | pub fn hello(_: TokenStream) -> TokenStream { | |
cc61c64b XL |
25 | quote!({ |
26 | fn hello() {} | |
27 | macro_rules! m { ($$($$t:tt)*) => { $$($$t)* } } | |
28 | m!(hello()); | |
29 | }) | |
32a655c1 | 30 | } |