Repository navigation
Remove syn_derive to address RUSTSEC-2026-0173 - #70
Merged
Merged
Conversation
RUSTSEC-2026-0173 reports that proc-macro-error2 is unmaintained and recommends migrating away from it. This advisory prompted removing syn_derive, which brings proc-macro-error2 into rstml transitively. Replace the Parse and ToTokens derives with explicit implementations across the workspace, preserving the public API and token behavior. Remove the dependency declarations and add focused round-trip coverage. Advisory: https://rustsec.org/advisories/RUSTSEC-2026-0173.html
Use a small impl_to_tokens! helper in each crate for structs whose fields already implement ToTokens. Exhaustive destructuring keeps the field list complete while preserving emission order.
Use a small impl_parse! helper in each crate for sequential field parsing. Preserve field order and error propagation while keeping custom parsers explicit.
Author
|
@vldm Does it look okay? |
Collaborator
|
@larstobi thanks, looks good to me. |
Author
|
@vldm The formatting job failed because nightly rustfmt changed its |
This was referenced Sep 26, 2026
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.
rstmlpulls inproc-macro-error2throughsyn_derive. RUSTSEC-2026-0173 reports thatproc-macro-error2is unmaintained and recommends migrating away from it.A fix has also been proposed upstream in Kyuuhachi/syn_derive#7, which remains open without review.
syn_deriveappears to be unmaintained: its latest commit onmainis from November 2024. Removing the dependency letsrstmladdress the advisory without waiting for an upstream release.Remove
syn_derivethroughout the workspace, replacing its derives with localParseandToTokensimplementations. Small privateimpl_parse!andimpl_to_tokens!macros handle sequential field parsing and straightforward field emission; custom parsing and token handling remain explicit. This removessyn_derive,proc-macro-error2, andproc-macro-error-attr2while preserving the public API, token order, delimiters, and spans. Add focused round-trip coverage for nodes and both control-flow syntaxes.Validated with stable and nightly workspace tests (including UI tests), the CI feature tests, rustfmt, and Clippy with
-D warnings. Confirmed the removed dependencies are absent with all workspace features enabled.