From fd5b1583fe3c7e2a866b18a42e9dcde0c647802d Mon Sep 17 00:00:00 2001 From: León Orell Valerian Liehr Date: Fri, 2 May 2025 23:03:30 +0200 Subject: Don't delay a bug on malformed meta items involving interpolated tokens MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Jana Dönszelmann --- .../ui/attributes/auxiliary/derive_macro_with_helper.rs | 8 ++++++++ tests/ui/attributes/proc_macro_in_macro.rs | 16 ++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 tests/ui/attributes/auxiliary/derive_macro_with_helper.rs create mode 100644 tests/ui/attributes/proc_macro_in_macro.rs (limited to 'tests/ui/attributes') 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 . +//@ 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() {} -- cgit 1.4.1-3-g733a5