about summary refs log tree commit diff
path: root/tests/ui/auxiliary/hello_macro.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/auxiliary/hello_macro.rs')
-rw-r--r--tests/ui/auxiliary/hello_macro.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/ui/auxiliary/hello_macro.rs b/tests/ui/auxiliary/hello_macro.rs
new file mode 100644
index 00000000000..a05b8d54dc1
--- /dev/null
+++ b/tests/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());
+    })
+}