test: cover serde attributes forwarded through another attribute#546
Merged
Conversation
Merged
Boshen
added a commit
that referenced
this pull request
Jul 16, 2026
## 🤖 New release * `cargo-shear`: 1.13.1 -> 1.13.2 (✓ API compatible changes) <details><summary><i><b>Changelog</b></i></summary><p> <blockquote> ## [1.13.2](v1.13.1...v1.13.2) - 2026-07-16 ### <!-- 1 -->🐛 Bug Fixes - detect serde attributes inside macros ([#543](#543)) (by @Boshen) ### <!-- 3 -->📚 Documentation - add security policy ([#537](#537)) (by @Boshen) ### <!-- 6 -->🧪 Testing - cover serde attributes forwarded through another attribute ([#546](#546)) (by @Boshen) ### Contributors * @renovate[bot] * @Boshen </blockquote> </p></details> --- This PR was generated with [release-plz](https://github.com/release-plz/release-plz/).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a regression test for a
serdeattribute forwarded through another attribute, as confik does:This is the shape reported in #542. It is not a macro body — confik is a derive macro, so the attribute is a plain
Attrnode. It failed becausecollect_meta_importsonly callscollect_serde_attributewhen the attribute's own path is literallyserde, and here it isconfik.#543 already fixes it: the token scan added in
collect_token_treeruns on every attribute's token tree and matches on aserdeident anywhere in the stream, so the nestedserde(...)is picked up regardless of the outer path. The existingserde_attributes_inside_macrotest does not cover this path — it would keep passing if the scan were ever narrowed to the attribute path or scoped to macro bodies, silently regressing confik. This test pins that behaviour: it fails with the #543 hunk reverted (left: {}, right: {"foo"}).