idanarye / rust-typed-builder

Compile-time type-checked builder derive
https://crates.io/crates/typed-builder
Apache License 2.0
922 stars 52 forks source link

Reconsider bumping minor version on backwards-compatible updates because it contradicts `cargo`'s semver #62

Open Veetaha opened 2 years ago

Veetaha commented 2 years ago

Context

I'd like to remind how specifying dependencies works in Cargo.toml.

When you specify a bare version e.g. foo = "0.1" , cargo prepends a caret operator by default and treats it as foo = "^0.1". According to the docs referenced higher cargo's caret operator treats 0 major version dependencies specially in such a way that it thinks that transition from 0.1.0 to 0.2.0 is a breaking change, that's why it can't deduplicate the dependency tree if there are multiple entries of the same 0-major version crate with different minor versions.

What this all means: The minor version of the crates that have 0 major version shouldn't be incremented if there were no breaking changes in that update. You'd better make the crate have >0 major version or bump just the patch component, otherwise, this is a disruptive update of the minor version that requires explicitly updating version requirements in all of the crate's reverse dependencies due to cargo's special treatment of unstable 0-major version crates.

Summary

According to the changelog, version 0.10 of typed_builder is backward-compatible with 0.9.1, so it should've been 0.9.2 to prevent the disruption. There is no clean solution to fix the aftermath, so we'll just have to live with it. This issue is mostly FYI, to prevent sudden disruptions in future.