Home

Awesome

cargo-breaking

! Disclaimer !: This repository is no longer maintained and our advice is to use https://crates.io/crates/cargo-semver-checks instead.

<div style="text-align: center;" align="center"> <img src="https://raw.githubusercontent.com/iomentum/cargo-breaking/main/logo-full.svg" width="500" /> <br/>

Logo is provided by Morgane Gaillard (<a href="https://github.com/Arlune">@Arlune</a>) under the MPL license.

</div>

cargo-breaking compares a crate's public API between two different branches, shows what changed, and suggests the next version according to semver.

Example

Suppose you're building a crate that, for any reason, deals with users. The crate version is 2.4.3. You remove the User::from_str method, add a new public field to User, implement Debug for it and add the User::from_path function.

When invoked, the following text should be printed:

$ cargo breaking
- user::User::from_str
≠ user::User
+ user::User::from_path
+ user::User: Debug

Next version is: 3.0.0

Args

against, an arg to specify the github ref (a tag, a branch name or a commit) against which we can compare our current crate version.

cargo breaking -a branch_name

Goals and non goals

cargo-breaking aims to detect most breaking changes, but deliberately chooses to ignore the most subtle ones. This includes, but is not limited to:

Status

By default, cargo-breaking compares the public API of the crate against what is exposed in the main branch. This can be changed with the --against (abbreviated by -a) parameter. The value can be a branch name, a tag name, or a commit SHA-1.

It currently detects the following:

As we compare parts of the crate AST, it reports a lot of false positives:

Contribution

A book is maintained to help understanding how the crate works, and what are its inner parts and their behaviour.

It can be found here : book