Linux command
cargo-msrv 命令
文件
复制后可按需替换文件名、目录或参数。
常用示例
Find minimum supported Rust version
cargo msrv find
Find using linear search
cargo msrv find --linear
Verify current MSRV works
cargo msrv verify
Show declared MSRV
cargo msrv show
Set MSRV in Cargo.toml
cargo msrv set [1.56.0]
List dependency MSRVs
cargo msrv list
Find for specific path
cargo msrv --path [/path/to/project] find
说明
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.
参数
- --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
FAQ
What is the cargo-msrv command used for?
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.
How do I run a basic cargo-msrv example?
Run `cargo msrv find` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does --path _dir_ do in cargo-msrv?
Project directory path