#cargo #subcommand #testing

app cargo-minimal-versions

Cargo subcommand for proper use of -Z minimal-versions

12 releases

0.1.11 Jan 24, 2023
0.1.9 Dec 25, 2022
0.1.8 Nov 27, 2022
0.1.5 Jul 8, 2022
0.1.0 Dec 28, 2021

#222 in Cargo plugins

Download history 61/week @ 2022-10-12 110/week @ 2022-10-19 102/week @ 2022-10-26 97/week @ 2022-11-02 106/week @ 2022-11-09 57/week @ 2022-11-16 70/week @ 2022-11-23 53/week @ 2022-11-30 61/week @ 2022-12-07 57/week @ 2022-12-14 74/week @ 2022-12-21 52/week @ 2022-12-28 59/week @ 2023-01-04 98/week @ 2023-01-11 96/week @ 2023-01-18 121/week @ 2023-01-25

382 downloads per month

Apache-2.0 OR MIT

911 lines


crates.io license rustc build status

Cargo subcommand for proper use of -Z minimal-versions.


Click to show a complete list of options
$ cargo minimal-versions --help

Cargo subcommand for proper use of -Z minimal-versions.

    cargo minimal-versions <SUBCOMMAND> [CARGO_OPTIONS]


To check all crates with minimal version dependencies:

cargo minimal-versions check --workspace

Note: (If cargo-minimal-versions determined that it is necessary to do so for a correct minimal versions check) cargo-minimal-versions modifies Cargo.toml and Cargo.lock while running and restores it when finished. Any changes you made to those files during running will not be preserved.

Normally, crates with publish = false do not need minimal versions check. You can skip these crates by using --ignore-private flag.

cargo minimal-versions check --workspace --ignore-private


Using -Z minimal-versions in the usual way will not work properly in many cases. To use cargo check with -Z minimal-versions properly, you need to run at least three processes.

If I remember correctly, cargo check -Z minimal-versions doesn't really do anything. It needs to be separated into cargo update -Z minimal-versions and cargo check.

Also, dev-dependencies may raise version requirements. Ideally, remove them before run cargo update -Z minimal-versions. (Also, note that Cargo.lock is actually shared within the workspace. However as far as I know, there is no workaround for this yet.)

In addition, due to cargo's feature integration, it is not correct to run cargo check or cargo build with -p (--package) or --workspace (--all) or on virtual manifest. To handle this problem correctly, you need the workspace handling provided by subcommands such as cargo hack.

cargo-minimal-versions addresses most of these issues and makes it easy to run cargo commands with -Z minimal-versions.

See #1 for the remaining problem.



cargo-minimal-versions requires nightly toolchain (to run cargo update -Z minimal-versions) and cargo-hack (to run cargo check & cargo build proper):

rustup toolchain add nightly
cargo +stable install cargo-hack --locked

From source

cargo +stable install cargo-minimal-versions --locked

Compiler support: requires rustc 1.60+

From prebuilt binaries

You can download prebuilt binaries from the Release page. Prebuilt binaries are available for macOS, Linux (gnu and musl), Windows (static executable), and FreeBSD.

Example of script to download cargo-minimal-versions
# Get host target
host=$(rustc -Vv | grep host | sed 's/host: //')
# Download binary and install to $HOME/.cargo/bin
curl -LsSf https://github.com/taiki-e/cargo-minimal-versions/releases/latest/download/cargo-minimal-versions-$host.tar.gz | tar xzf - -C $HOME/.cargo/bin

On GitHub Actions

You can use taiki-e/install-action to install prebuilt binaries on Linux, macOS, and Windows. This makes the installation faster and may avoid the impact of problems caused by upstream changes.

- uses: taiki-e/install-action@cargo-hack
- uses: taiki-e/install-action@cargo-minimal-versions

Via Homebrew

You can install cargo-minimal-versions using Homebrew tap on macOS and Linux:

brew install taiki-e/tap/cargo-minimal-versions

Via Scoop (Windows)

You can install cargo-minimal-versions using Scoop:

scoop bucket add taiki-e https://github.com/taiki-e/scoop-bucket
scoop install cargo-minimal-versions

Via cargo-binstall

You can install cargo-minimal-versions using cargo-binstall:

cargo binstall cargo-minimal-versions
  • cargo-hack: Cargo subcommand to provide various options useful for testing and continuous integration.
  • cargo-llvm-cov: Cargo subcommand to easily use LLVM source-based code coverage.
  • cargo-config2: Library to load and resolve Cargo configuration.


Licensed under either of Apache License, Version 2.0 or MIT license at your option.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.


~171K SLoC