From bb57031b8c4bf71e19efa881527f76999671ee8f Mon Sep 17 00:00:00 2001 From: Boshen Date: Thu, 16 Jul 2026 19:42:17 +0800 Subject: [PATCH] test: cover serde attributes forwarded through another attribute --- src/tests.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/tests.rs b/src/tests.rs index ab41a2e..bb7ddb7 100644 --- a/src/tests.rs +++ b/src/tests.rs @@ -130,6 +130,16 @@ fn serde_attributes_inside_macro() { test("m! { #[serde(remote = \"foo\")] struct Bar; }"); } +// A `serde(...)` forwarded through another attribute is reached only by the token +// scan: the `Attr` path is `confik`, so the path check in `collect_meta_imports` +// never fires. Gating that scan on the attribute path would silently break this. +// https://docs.rs/confik/0.15.12/confik/#forwarding-attributes +#[test] +fn serde_attributes_forwarded_by_another_attribute() { + test("struct Foo { #[confik(forward(serde(with = \"foo\")))] f: () }"); + test("#[confik(forward(serde(crate = \"foo\")))] struct Foo { f: () }"); +} + #[test] fn test_lib() { let shear = CargoShear::new(