3 ms·
Post co-author + `cargo-semver-checks` maintainer here, AMA. What we did: 1. Scan Rust's most popular 1000 crates with `cargo-semver-checks` 2. Triage & veri
by obi1kenobi 3y ago
Post co-author + `cargo-semver-checks` maintainer here, AMA.
What we did:
1. Scan Rust's most popular 1000 crates with `cargo-semver-checks`
2. Triage & verify 3000+ semver violations
3. Build better tooling instead of blaming human error
Around 1 in 31 releases had at least one semver violation.
More than 1 in 6 crates violated semver in at least one release.
These numbers aren't just "sum up everything `cargo-semver-checks` reported." We did a ton of validation through a combination of automated and manual means, and a big chunk of the blog post is dedicated to talking about that.
Here's just one of those validation steps. For each breaking change, we constructed a "witness," a program that gets broken by it. We then verified that it:
- fails to compile on the release with the semver-violating change
- compiles fine on the previous version
Along the way, we discovered multiple `rustc` and `cargo-semver-checks` bugs, and found out a lot of interesting edge cases about semver. Also, now you know another reason why it was so important to us to add those huge performance optimizations from a few months ago: https://predr.ag/blog/speeding-up-rust-semver-checking-by-over-2000x/ https://predr.ag/blog/speeding-up-rust-semver-checking-by-ov...
- obi1kenobi 3y agoIf you'd like to dig deeper, here are some links: - cargo-semver-checks: https://github.com/obi1kenobi/cargo-semver-checks https://github.com/obi1kenobi/cargo-semver-checks - Trustfall query engine, which powers cargo-semver-checks: https://github.com/obi1kenobi/trustfall https://github.com/obi1kenobi/trustfall - Trustfall playground, where you can query Rust library APIs in your browser -- for example, "which structs in `itertools` are importable by more than one path": https://play.predr.ag/rustdoc#?f=2&q=*3-Structs-importable-from-the-crate-via-multiple-paths*lquery---0Crate---2item---4*E-Struct---6name-*o*l*l--_6importable_path-*F*l--_m*T*9*p-**count***0*l--_m*f*9*p-***G*e***L-*v-*c***4path_count***j*0*l--_6--8path-*o*l--_6*J*l*l--_6span---8filename-*o*l--_8first_line*B-begin_line-*o*l--_6--*4--*2--*0*J*l*J&v=--0**path_count***B-2*l*J https://play.predr.ag/rustdoc#?f=2&q=*3-Structs-importable-f... - 10min conference talk on Trustfall: https://www.hytradboi.com/2022/how-to-query-almost-everything https://www.hytradboi.com/2022/how-to-query-almost-everythin... I'm also giving a talk at P99 CONF in a few months about how Trustfall's new optimizations API made cargo-semver-checks over 2300x faster: https://twitter.com/PredragGruevski/status/1689300249590800386 https://twitter.com/PredragGruevski/status/16893002495908003...