Skip to content

syn dependency version bound is incompatible with prettyplease #3448

Open

Description

@ds84182

I have the following build dependencies in my crate:

bindgen = "0.73.1"
cmake = "0.1.58"

The syn version bound in bindgen (>=2, <4) allows Cargo to select a 2.x release (2.0.119) for bindgen and a 3.x release (3.0.3) for prettyplease, which causes a compilation error. Why cargo picks an old syn release for bindgen is beyond me.

This is one of those cases where I just shut my computer off and go do something else, because it is 11pm and I do not feel like spending the rest of my Saturday night hitting cargo with a rock until it does the right thing.

Activity

  1. emilio commented on Sep 6, 2026

    @emilio
    Contributor

    I'm confused, it should allow getting syn 3 right?

    A minimal test-case would be good, because I just created a directory with those dependencies and I can't reproduce.

  2. ds84182 commented on Sep 7, 2026

    @ds84182
    Author

    It seems to only happen in my workspace because when I tried making a testcase it doesn't happen. My current workaround is to run cargo update --ignore-rust-version, but running cargo add breaks it again. My rustc version is rustc 1.96.0-nightly (b90dc1e59 2026-03-04).

  3. emilio commented on Sep 7, 2026

    @emilio
    Contributor

    Seems like this should move upstream?

  4. djc commented on Oct 4, 2026

    @djc

    Seems like this should move upstream?

    I don't think it's reasonable to expect Cargo's resolver to match up the prettyplease version with the one used by syn necessarily, when another version of bindgen is using old syn + prettyplease. The open PR looks like a proper fix to me:

    The current "parallel ranges" approach just seems broken.

  5. austek commented on Oct 12, 2026

    @austek

    Another real-world hit, in case it helps with the missing test case: a Renovate bump of bindgen 0.72.1 to 0.73.2 in a workspace whose lockfile already had prettyplease 0.2.37 and a syn 3 dependency elsewhere. bindgen 0.73.2 resolved to syn 3.0.5 but kept prettyplease 0.2.37, which uses syn 2, and failed with the trait bound syn::file::File: syn::parse_quote::ParseQuote is not satisfied.

    I could not reduce it to a minimal project. A fresh resolve, and adding 0.73.2 next to 0.72.1 in an existing lock (with or without a direct syn = "3"), both gave a consistent pairing. It needs an existing lock entry plus syn 3 pulled in by another crate.

    cargo update -p prettyplease fixed it by adding prettyplease 0.3.0 next to 0.2.37. Agree with the comment above: #3506 looks like the proper fix.

  6. added a commit that references this issue on Oct 17, 2026
  7. added a commit that references this issue on Oct 18, 2026
  8. added a commit that references this issue on Oct 21, 2026
  9. ettolrach commented on Oct 21, 2026

    @ettolrach

    I came across this again when updating rustls-webpki and webpki-root-certs. It's likely others will come across the same issue too, especially with the recent CVEs that were released.

    Specifically, have a Cargo.toml file like so:

    [package]
    name = "ex"
    version = "0.1.0"
    edition = "2024"
    
    [dependencies]
    bindgen = "=0.73.2"
    syn = "=2.0.119"
    rustls-webpki = { version = "=0.103.16", default-features = false }
    webpki-root-certs = "=1.0.10"
    rustls-pki-types = { version = "=1.15.1", features = ["web"] }

    then run the following commands.

    cargo generate-lockfile
    cargo check --locked
    cargo update rustls-webpki && cargo update webpki-root-certs
    cargo check --locked

    It can be fixed by then running cargo update bindgen.

    It's ultimately caused by rust-lang/cargo#13942 but I think it should still be fixed in bindgen.

  10. xtqqczze commented on Oct 28, 2026

    @xtqqczze
    Contributor

    cargo update -p prettyplease fixed it by adding prettyplease 0.3.0 next to 0.2.37

    I just encountered this issue with bindgen as a transitive dependency. Manually updating prettyplease also resolved it for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions