rust-lang / rust-bindgen

Automatically generates Rust FFI bindings to C (and some C++) libraries.
https://rust-lang.github.io/rust-bindgen/
BSD 3-Clause "New" or "Revised" License
4.23k stars 679 forks source link

bindgen has bumped MSRV without updating semver #2850

Closed CGMossa closed 2 weeks ago

CGMossa commented 2 weeks ago

Hey! We've been using 0.69.4 for a while, and suddenly the MSRV was bumped to 1.70. The reason for this is the home-crate.

cargo clean; rm Cargo.lock; cargo msrv --min 1.67.0
# redacted
Check for toolchain '1.69.0-aarch64-apple-darwin' failed with:
┌──────────────────────────────────────────────────────────────────────────┐
│ error: package `home v0.5.9` cannot be built because it requires rustc   │
│ 1.70.0 or newer, while the currently active rustc version is 1.69.0      │
│ Either upgrade to rustc 1.70.0 or newer, or use                          │
│ cargo update -p home@0.5.9 --precise ver                                 │
│ where `ver` is the latest version of `home` supporting rustc 1.69.0      │
└──────────────────────────────────────────────────────────────────────────┘
   Finished The MSRV is: 1.70.0

It has caused a bit of trouble for us, that we suddenly have to bump MSRV to 1.70.0. Is it at all possible for someone to deal with this?

madsmtm commented 2 weeks ago

Hmm, the home crate does not seem to be a dependency of bindgen?

Besides, bindgen does not have an established MSRV policy (see the README), so such a bump is not a violation of SemVer.

In any case, I'd suggest you resolve this by applying the solution suggested by Cargo.

CGMossa commented 2 weeks ago

Thanks for the answer. You've now answered two questions from me, so thank you very much.

I ran this

cargo update -p home@0.5.9 --precise 0.5.5

and then the MSRV is The MSRV is: 1.67.1. How do I make that the case for my library and all dependents of it? Do I just commit the Cargo.lock file?

madsmtm commented 2 weeks ago

How do I make that the case for my library and all dependents of it?

You should not, you should raise your own MSRV to match the dependency, and then tell users on lower Rust versions the same advice as here (i.e. to follow Cargo's suggestions).

I think the docs in which's README are a fairly good candidate as to what you could write yourself.

madsmtm commented 2 weeks ago

An alternative, if you really want to be nice to your users, would be to run bindgen in a helper script instead, for all the platforms that you target, and then commit and publish the generated files instead (fully avoiding the dependency on bindgen from the user's perspective).

Though the developer story for doing so is... Quite bad right now.

pvdrz commented 2 weeks ago

Closing as bindgen 0.69.4 effectively compiles with a 1.67.0 toolchain.

Also bindgen is a pre 1.0 crate and any incompatibility will produce at most a minor version bump.