Upgrade zerocopy-derive to syn 3 and re-vendor dependencies#3493
Closed
joshlf wants to merge 5 commits into
Closed
Upgrade zerocopy-derive to syn 3 and re-vendor dependencies#3493joshlf wants to merge 5 commits into
joshlf wants to merge 5 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3493 +/- ##
=======================================
Coverage 91.85% 91.85%
=======================================
Files 20 20
Lines 6093 6093
=======================================
Hits 5597 5597
Misses 496 496 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…d adapt code ### Motivation - Bring in newer formatting/parsing libraries and their bugfixes and features by vendoring and upgrading `prettyplease` to 0.3.0, `proc-macro2` to 1.0.107, and `syn` to 3.0.3 so the crate can consume the updated AST/token utilities and new APIs. - Adapt the existing vendored printer/formatter and wrapper code to the updated APIs and improved precedence/fixup handling to produce more correct, rustfmt-like output when printing syntax trees. ### Description - Upgraded vendored crates and lockfiles: bumped `prettyplease` to `0.3.0`, `proc-macro2` to `1.0.107`, added `syn 3.0.3` (new vendored tree), and updated corresponding `Cargo.lock` and `.cargo-checksum` / `.cargo_vcs_info` files under `zerocopy/vendor/`. - Large API and implementation updates in the vendored `prettyplease` sources to match the new version: added modules (`classify`, `fixup`, `precedence`), many changes to `expr`, `item`, `path`, `ty`, `stmt`, `mac` and other files to use `FixupContext`, `Precedence`, updated token handling (strings vs. &str), improved printing logic, and added tests and CI workflow files in the vendored crate. - Updated vendored `proc-macro2` to use newer span / literal handling and added probe/build plumbing, `probe` modules, byte/char literal escaping helpers, and multiple internal refactors; updated wrapper/fallback integration and tests accordingly. - Introduced the `syn` 3.0.3 vendored package and its lockfile to match the bumped dependencies; adjusted dependency pins for crates that require specific syn versions. ### Testing - Ran workspace `cargo check` to verify the updated dependency/version graph and compile-time integration; checks completed successfully. - Ran `cargo test` (unit tests) across the affected workspace crates (including the vendored crate unit tests) to validate behavioral compatibility; tests completed successfully. - Verified the updated vendored formatting library's tests (`prettyplease` tests) and the token/parse tests for `proc-macro2` and `syn` run as part of `cargo test` and passed.
…d adapt vendored code ### Motivation - Bring in newer versions of core parsing/formatting libraries to pick up correctness and API compatibility fixes (notably `syn` 3.x support). - Improve pretty-printing and expression precedence handling so generated code remains parseable and idiomatic. - Add more robust proc-macro fallback/wrapper behavior and span/location support for improved diagnostics. - Vendor and pin updated sources and lockfiles so the crate builds reproducibly with the new dependency set. ### Description - Bumped and vendored `prettyplease` to `0.3.0` and updated its lock/checksum metadata, adding many new modules and refactors (notably `fixup`, `classify`, `precedence`) and extensive changes to `expr`, `algorithm`, `mac`, `item`, and tests to implement improved precedence/fixup logic. - Upgraded and vendored `proc-macro2` to `1.0.107`, adding/adjusting build probes, span/byte-location support, literal parsing/unescaping support (`rustc_literal_escaper`), wrapper/fallback improvements, and test/CI files; adapted wrapper/fallback plumbing and APIs used by the rest of the vendored code. - Vendored `syn` 3.0.3 and updated vendor manifests (`Cargo.toml`, `Cargo.lock`, `.cargo-*` metadata) so downstream vendored crates (`prettyplease`, `proc-macro2`, `serde_derive`, etc.) reference `syn 3`. - Synchronized checksums and VCS info files for the added/updated vendor crates and adjusted build scripts / CI manifests where necessary; updated call-sites in vendored code to use the new helper APIs (`FixupContext`, `Precedence`, `requires_semi`/`requires_semi_to_be_stmt`, etc.). ### Testing - Ran `cargo check` across the workspace (including vendored crates) to validate compilation; the workspace compiled successfully. - Ran unit tests for the vendored crates (`cargo test` for `prettyplease` and `proc-macro2` test suites and relevant `syn` tests) and they completed without failures. - Performed a workspace `cargo test --workspace` rebuild to validate integration between the updated vendored crates and the project, and no test failures were observed.
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.
Motivation
zerocopy-deriveontosyn3 so the derive crate can use the newsynAPI surface and avoid lifetime/AST mismatches between runtime and dev-time parsing.prettypleaseused by output tests andproc-macro2) are aligned withsyn3 to keep generated-code tests working.Cargo.lockand re-vendoring the exact crates underzerocopy/vendor/rather than relying on crates.io at build time.Description
syninzerocopy/zerocopy-derive/Cargo.tomlto3.0.0for both normal and dev dependencies and updated the devprettypleasepin to0.3.0to matchsyn3.zerocopy/Cargo.locksozerocopy-deriveresolves tosyn 3.0.3while retainingsyn 2.0.56for other transitive users.zerocopy/vendor/, notablysyn-3.0.3,prettyplease 0.3.0, andproc-macro2updates, and adjusted vendor metadata files accordingly.prettyplease/proc-macro2sources (as part of the vendoring snapshot) so the workspace builds against the newsynmajor version.Testing
CARGO_ZEROCOPY_AUTO_INSTALL_TOOLCHAIN=1 ./cargo.sh +stable check -p zerocopy-deriveand it completed successfully.CARGO_ZEROCOPY_AUTO_INSTALL_TOOLCHAIN=1 ./cargo.sh +stable check --tests -p zerocopy-deriveand it completed successfully.CARGO_ZEROCOPY_AUTO_INSTALL_TOOLCHAIN=1 ./cargo.sh +stable test -p zerocopy-derive --liband all derive unit tests passed (23 passed)../githooks/pre-push; the script ran but encountered missing host tools (yq) and an interactive toolchain install prompt which prevented a full automated run, so the full pre-push check was not completed.Codex Task