summary refs log tree commit diff
path: root/tests/ui/attributes
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/attributes')
-rw-r--r--tests/ui/attributes/auxiliary/derive_macro_with_helper.rs8
-rw-r--r--tests/ui/attributes/proc_macro_in_macro.rs16
2 files changed, 24 insertions, 0 deletions
diff --git a/tests/ui/attributes/auxiliary/derive_macro_with_helper.rs b/tests/ui/attributes/auxiliary/derive_macro_with_helper.rs
new file mode 100644
index 00000000000..128af50ce36
--- /dev/null
+++ b/tests/ui/attributes/auxiliary/derive_macro_with_helper.rs
@@ -0,0 +1,8 @@
+extern crate proc_macro;
+
+use proc_macro::TokenStream;
+
+#[proc_macro_derive(Derive, attributes(arg))]
+pub fn derive(_: TokenStream) -> TokenStream {
+    TokenStream::new()
+}
diff --git a/tests/ui/attributes/proc_macro_in_macro.rs b/tests/ui/attributes/proc_macro_in_macro.rs
new file mode 100644
index 00000000000..ebe67d2a321
--- /dev/null
+++ b/tests/ui/attributes/proc_macro_in_macro.rs
@@ -0,0 +1,16 @@
+// Regression test for <https://github.com/rust-lang/rust/issues/137687#issuecomment-2816312274>.
+//@ proc-macro: derive_macro_with_helper.rs
+//@ edition: 2018
+//@ check-pass
+
+macro_rules! call_macro {
+    ($text:expr) => {
+        #[derive(derive_macro_with_helper::Derive)]
+        #[arg($text)]
+        pub struct Foo;
+    };
+}
+
+call_macro!(1 + 1);
+
+fn main() {}