Skip to content

Remove syn_derive to address RUSTSEC-2026-0173 - #70

Merged
vldm merged 4 commits into
rs-tml:mainfrom
larstobi:fix/remove-syn-derive
Sep 25, 2026
Merged

vldm merged 4 commits into
rs-tml:mainfrom
larstobi:fix/remove-syn-derive

Conversation

@larstobi

@larstobi larstobi commented Sep 21, 2026 •

Copy link
Copy Markdown

rstml pulls in proc-macro-error2 through syn_derive. RUSTSEC-2026-0173 reports that proc-macro-error2 is 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_derive appears to be unmaintained: its latest commit on main is from November 2024. Removing the dependency lets rstml address the advisory without waiting for an upstream release.

Remove syn_derive throughout the workspace, replacing its derives with local Parse and ToTokens implementations. Small private impl_parse! and impl_to_tokens! macros handle sequential field parsing and straightforward field emission; custom parsing and token handling remain explicit. This removes syn_derive, proc-macro-error2, and proc-macro-error-attr2 while 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.

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.
@larstobi

Copy link
Copy Markdown
Author

@vldm Does it look okay?

@vldm

vldm commented Sep 25, 2026

Copy link
Copy Markdown
Collaborator

@larstobi thanks, looks good to me.

@larstobi

Copy link
Copy Markdown
Author

@vldm The formatting job failed because nightly rustfmt changed its wrap_comments output to account for indentation (rustfmt#6802). Commit 4e85479 accepts the new output; there are no functional code changes.

@vldm
vldm added this pull request to the merge queue Sep 25, 2026
Merged via the queue into rs-tml:main with commit 29c619b Sep 25, 2026
3 checks passed
@larstobi
larstobi deleted the fix/remove-syn-derive branch September 25, 2026 21:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants