]> git.proxmox.com Git - rustc.git/blame - src/test/run-pass-fulldeps/auxiliary/hello_macro.rs
New upstream version 1.31.0~beta.4+dfsg1
[rustc.git] / src / test / run-pass-fulldeps / auxiliary / hello_macro.rs
CommitLineData
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"]
0bf4aa26 14#![feature(proc_macro_hygiene, proc_macro_quote)]
32a655c1 15
041b39d2 16extern crate proc_macro;
32a655c1 17
041b39d2 18use 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]
24pub fn hello(_: TokenStream) -> TokenStream {
cc61c64b
XL
25 quote!({
26 fn hello() {}
27 macro_rules! m { ($$($$t:tt)*) => { $$($$t)* } }
28 m!(hello());
29 })
32a655c1 30}