← Back to Pull requests

Upgrade syn to v3 (continues #350) #355

Closed
unknown closed this pull request without merging on Nov 11, 2026 18:55 UTC
View on GitHub
unknown unknown commented on Nov 11, 2026 15:13 UTC
Author

Continues #350 by @wojciech-graj. The first commit is theirs, with its author kept. It moves rstest_macros and rstest_reuse to syn 3.0. The next commits answer the review of #350.

The two review points of #350:

  • use_default_values_attributes: the assertion is back. In syn 3, ItemFn has a new field modifiers: FnModifiers, and FnModifiers has a field defaultness. So format!("{:?}", item_fn) always contains "default", and the old assertion !format!("{:?}", item_fn).contains("default") cannot hold. The test checks that extend_with_function_attrs removes the #[default(...)] argument attributes. It now compares the function with fn my_fix(f1: &str, f2: (Vec<u32>, &str)) {}. It fails when the attributes stay: I checked this with a JustOnceFnArgAttributeExtractor that keeps them.

  • The error for #[timeout(some -> strange -> invalid -> expression)] changes from error: expected an expression to error: unexpected token. The text comes from syn (Attribute::parse_args::<Expr>()), not from rstest. syn 3.0.8 (syn#2086 and syn#2087) changed how -> and <- are parsed in expressions. Before, some -> strange was some - with no right side, and the error was at the >. Now it is some followed by an unexpected ->, and the error is at the -. syn 3.0.0 to 3.0.7 give the old error, so rstest_macros now requires syn 3.0.8. The expected text in rstest/tests/rstest/mod.rs changes from 112:17 to 112:16.
  • That test is the only expected output that changes. I built the 107 files in rstest/tests/resources and rstest_reuse/tests/resources with master and with this branch, on stable, beta and nightly, and compared the compiler output. Only the file with that error differs, apart from the random macro names in two rstest_reuse warnings. On nightly I also compared the macro-expanded source (-Zunpretty=expanded): it is the same, except for the random macro names of rstest_reuse.

    Other syn 3 changes that touch rstest:

  • Signature::unsafety is now Signature::safety. rstest reads it only in the itemfn_near_match test helper (changed in #350).

  • The same syn 3.0.8 change rejects a <-b, as rustc does. syn 2 read it as a < -b, so #[case(1 <-2)] compiled. Now it needs #[case(1 < -2)]. The CHANGELOG says so.
  • The other changes in the syn 3.0.0 release notes (Type::BareFn, Arm::guard, Punctuated::pop, visit of spans and the rest) are not used by rstest. The features full, parsing, extra-traits, visit and visit-mut still exist.

    MSRV is not changed (1.85). rust-version is 1.71 for syn 3.0.10, proc-macro2 1.0.107, quote 1.0.47 and unicode-ident 1.0.27. The msrv job of #350 failed with actix-macros@0.2.5 requires rustc 1.88, a dev dependency of rstest. It was not a syn problem, and #352 fixed it (resolver 3). The job passes here.

    cargo tree -e normal,build -d shows one syn (3.0.10) for rstest_macros and for rstest. rstest_reuse builds syn 2 as well, through rand 0.8 (zerocopy-derive). Before this change it built only syn 2.

    Tests:

  • cargo fmt --all -- --check and cargo clippy --all are clean.

  • RSTEST_TEST_CHANNEL=stable|beta|nightly cargo test --all passes, with nightly as the default toolchain as in CI.

  • cargo hack check/test --rust-version --workspace --ignore-private passes with Rust 1.85.1.

  • The rstest_macros unit tests pass with syn pinned to 3.0.8, the lower bound.

  • The Test workflow (ubuntu, windows, msrv) passes for these commits on my fork: https://github.com/jrandolf/rstest/actions/runs/43042100257

  • CHANGELOG entry under Unreleased.
  • Not tested: downstream projects (for example trybuild files with the old #[timeout(...)] error), the integration tests with syn pinned to 3.0.8, and a macOS or Windows run on my machine (Windows ran only in CI).

    Diff: 478 lines (+358 / -120) across 5 files Reviewer: jrandolf Review duration: 222m
    All Vouch review confidence checks passed
    Residual risk 0.18 = Change Risk (0.46) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.46 · 478 lines diff across 5 files
    0.46
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.369
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #355"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 45.8% (MEDIUM) · Higher = larger blast radius
    45.8%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 18.1% · Safe to merge
    18.1%
    Repository