summaryrefslogtreecommitdiffstats
path: root/src/test/ui/auxiliary/hello_macro.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/auxiliary/hello_macro.rs')
-rw-r--r--src/test/ui/auxiliary/hello_macro.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/test/ui/auxiliary/hello_macro.rs b/src/test/ui/auxiliary/hello_macro.rs
new file mode 100644
index 000000000..a05b8d54d
--- /dev/null
+++ b/src/test/ui/auxiliary/hello_macro.rs
@@ -0,0 +1,21 @@
+// 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());
+ })
+}