LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

cargo-msrv

Find and manage the minimum supported Rust version

TLDR

Find minimum supported Rust version
$ cargo msrv find
copy
Find using linear search
$ cargo msrv find --linear
copy
Verify current MSRV works
$ cargo msrv verify
copy
Show declared MSRV
$ cargo msrv show
copy
Set MSRV in Cargo.toml
$ cargo msrv set [1.56.0]
copy
List dependency MSRVs
$ cargo msrv list
copy
Find for specific path
$ cargo msrv --path [/path/to/project] find
copy

SYNOPSIS

cargo msrv [options] command

DESCRIPTION

cargo msrv finds and manages the Minimum Supported Rust Version (MSRV) for Rust projects. It determines the oldest Rust compiler version that can successfully build a crate by testing against available toolchains. By default it uses binary search to efficiently narrow down the compatible version range.Maintaining an accurate MSRV is important for library authors who want to support users on older Rust versions. The tool can automatically set the `rust-version` field in Cargo.toml after finding the minimum version, and verify that the declared MSRV remains valid as the codebase evolves.

PARAMETERS

--path dir

Project directory path
--linear
Use linear search instead of binary
--min version
Minimum version to consider
--max version
Maximum version to consider
--target triple
Target platform
--manifest-path path
Path to Cargo.toml
--write-msrv
Write found MSRV to Cargo.toml after find
--ignore-lockfile
Ignore the lockfile during MSRV determination

COMMANDS

find

Discover the MSRV by testing versions
verify
Check if project works with declared MSRV
show
Display MSRV from Cargo.toml
set version
Update rust-version in Cargo.toml
list
Show MSRVs of dependencies

REQUIREMENTS

Requires rustup for toolchain management.

CAVEATS

Binary search is much faster than linear for the many Rust minor versions. Requires rustup for downloading and managing toolchains. The `find` command compiles the project with each candidate version, which can be slow for large projects. The `rust-version` field in Cargo.toml only supports two-component versions (e.g., 1.56) since Rust 1.56.

SEE ALSO

cargo(1), rustup(1)

Copied to clipboard
Kai