{"id":20641935,"url":"https://github.com/clechasseur/msrv-prep","last_synced_at":"2026-01-22T11:33:38.524Z","repository":{"id":222045896,"uuid":"756071572","full_name":"clechasseur/msrv-prep","owner":"clechasseur","description":"Cargo subcommand useful to prepare for determining/verifying a crate's MSRV","archived":false,"fork":false,"pushed_at":"2025-12-29T05:06:13.000Z","size":459,"stargazers_count":1,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-01T01:21:41.358Z","etag":null,"topics":["cargo","cargo-plugin","cargo-subcommand","cli","rust","rust-lang","testing"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/clechasseur.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-02-11T22:11:35.000Z","updated_at":"2025-12-29T05:04:51.000Z","dependencies_parsed_at":"2024-03-21T13:43:05.177Z","dependency_job_id":"6374ca45-dd54-4bbe-a84e-4bb0a3f6be0e","html_url":"https://github.com/clechasseur/msrv-prep","commit_stats":null,"previous_names":["clechasseur/cargo-msrv-prep"],"tags_count":6,"template":false,"template_full_name":"clechasseur/rust-template","purl":"pkg:github/clechasseur/msrv-prep","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clechasseur%2Fmsrv-prep","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clechasseur%2Fmsrv-prep/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clechasseur%2Fmsrv-prep/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clechasseur%2Fmsrv-prep/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/clechasseur","download_url":"https://codeload.github.com/clechasseur/msrv-prep/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clechasseur%2Fmsrv-prep/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28662129,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-22T01:17:37.254Z","status":"online","status_checked_at":"2026-01-22T02:00:07.137Z","response_time":144,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cargo","cargo-plugin","cargo-subcommand","cli","rust","rust-lang","testing"],"created_at":"2024-11-16T16:07:18.803Z","updated_at":"2026-01-22T11:33:38.507Z","avatar_url":"https://github.com/clechasseur.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `cargo-msrv-prep`\n\n[![CI](https://github.com/clechasseur/msrv-prep/actions/workflows/ci.yml/badge.svg?branch=main\u0026event=push)](https://github.com/clechasseur/msrv-prep/actions/workflows/ci.yml) [![codecov](https://codecov.io/gh/clechasseur/msrv-prep/branch/main/graph/badge.svg?token=y4eecxkGcV)](https://codecov.io/gh/clechasseur/msrv-prep) [![Security audit](https://github.com/clechasseur/msrv-prep/actions/workflows/audit-check.yml/badge.svg?branch=main)](https://github.com/clechasseur/msrv-prep/actions/workflows/audit-check.yml) [![crates.io](https://img.shields.io/crates/v/cargo-msrv-prep.svg)](https://crates.io/crates/cargo-msrv-prep) [![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](CODE_OF_CONDUCT.md)\n\nA Cargo subcommand useful to prepare for determining/verifying a Rust crate's [MSRV](https://doc.rust-lang.org/cargo/reference/manifest.html#the-rust-version-field) (_Minimum Supported Rust Version_).\n\n## Installing\n\nVia `cargo`:\n\n```sh\ncargo install cargo-msrv-prep --locked\n```\n\nVia [`cargo-binstall`](https://github.com/cargo-bins/cargo-binstall):\n\n```sh\ncargo binstall cargo-msrv-prep\n```\n\nYou can also install it manually by downloading the appropriate executable from the [project's Releases page](https://github.com/clechasseur/msrv-prep/releases).\n\n### Dependencies\n\nThis tool is meant as a companion to the following tools (which are much cooler):\n\n* [`cargo-msrv`](https://github.com/foresterre/cargo-msrv): Cargo command to determine a crate's MSRV\n* [`cargo-hack`](https://github.com/taiki-e/cargo-hack): Cargo command providing tools for testing and CI\n* [`cargo-minimal-versions`](https://github.com/taiki-e/cargo-minimal-versions): Cargo command to fetch minimal dependencies (uses `cargo-hack` above)\n\nYou can visit these tools' GitHub pages to learn how to install them if you do not have them installed already.\n\n## Usage\n\nDetermining a Rust crate's Minimum Supported Rust Version is not so easy.\nThe [`cargo-msrv`](https://github.com/foresterre/cargo-msrv) tool is designed for this and allows running a check command (by default `cargo check`) using multiple Rust versions until the MSRV is found.\nHowever, there are a couple of issues with this:\n\n* If your crate has a `rust-version` field, it won't allow `cargo-msrv` to \"see\" a working lower MSRV.\n* In order to determine the _true_ MSRV, you need to build with the _minimum_ supported versions of all dependencies (transitively), but this is not the default behavior of Cargo.\n\nThe second issue can be partially circumvented by using a nifty tool called [`cargo-minimal-versions`](https://github.com/taiki-e/cargo-minimal-versions).\nIt allows running Cargo commands using the unstable [`-Z minimal-versions`](https://github.com/rust-lang/cargo/issues/5657) option to fetch minimum versions of dependencies.\nBy using this, we can run this to determine our crate's true MSRV:\n\n```sh\ncargo msrv find -- cargo minimal-versions check --workspace --lib --bins --all-features\n```\n\nBut there remains another issue: some crates specify erroneous minimum versions for their dependencies; the specified minimum versions are actually _too low_ and don't build.\nSometimes, it's because the minimum specified version of the dependency is old, used to build but no longer builds for various reasons (this can happen when that version of the dependency was created before Rust 1.0, for example).\nOther times, it can be because the crate's author specified a minimum dependency version that _used_ to work but now no longer works because they are using a feature of the dependency introduced later, but because Cargo always pulls the latest version of dependencies, the crate's author didn't notice.\n(This is another good reason why it's a good idea to _check_ that a crate's MSRV remains correct using CI.)\n\nThat last issue is unfortunately \"unsolvable\" - the faulty dependencies cannot be modified since they are published and set in stone.\nThe only solution is to \"pin\" some of the faulty dependencies to more recent versions through your workspace's `Cargo.toml` file.\n\nThis is where `cargo-msrv-prep` comes in. It loads a manifest (`Cargo.toml` file) and does two things:\n\n* If the manifest has a `rust-version` field (in the `package` table), it is removed\n* If a file named `msrv-pins.toml` exists next to the manifest, any dependencies specified in that file are merged with those in the manifest\n\nFor example, if your project had [this `Cargo.toml` file](./resources/tests/cargo-msrv-prep/simple_project/Cargo.toml) and [this `msrv-pins.toml` file](./resources/tests/cargo-msrv-prep/simple_project/msrv-pins.toml), running `cargo msrv-prep` would produce [this output](./resources/tests/cargo-msrv-prep/simple_project/expected/all.toml) (replacing the `Cargo.toml` file).\n\n(It's possible to override the name of the `msrv-pins.toml` file, change the backup file suffix, etc. Run `cargo msrv-prep --help` for all options.)\n\nRunning `cargo-msrv-prep` will back up all modified manifests. Another Cargo command, `cargo-msrv-unprep`, is provided to reverse the process.\n\nConsequently, you can use this tool to determine the true MSRV of your crate without needing to hack the `Cargo.toml` file by hand by running:\n\n```sh\ncargo msrv-prep --workspace\ncargo msrv find -- cargo minimal-versions check --workspace --lib --bins --all-features\ncargo msrv-unprep --workspace\n```\n\nIn order to _validate_ that the MSRV specified in your crate's manifest is correct, you can use `cargo-msrv-prep` like this:\n\n```sh\ncargo msrv-prep --workspace\ncargo minimal-versions check --workspace --lib --bins --all-features\n```\n\nHere's an example of a GitHub workflow to perform this validation in your CI.\nThis workflow uses [`taiki-e/install-action`](https://github.com/taiki-e/install-action) to install the required tools.\n\n```yaml\nname: MSRV check\n\non: [push]\n\njobs:\n  msrv-check:\n    name: MSRV check for Rust ${{ matrix.toolchain }} on ${{ matrix.os }}\n    strategy:\n      fail-fast: false\n      matrix:\n        toolchain: [ 1.74.1 ]          # Set this to the expected MSRV of your crate\n        os: [ ubuntu, macos, windows ] # It's probably a good idea to run this check on all supported OSes\n    runs-on: ${{ matrix.os }}-latest\n    steps:\n      - uses: actions/checkout@v4\n\n      - name: Install Rust nightly toolchain # Required for `cargo-minimal-versions` to work\n        uses: actions-rust-lang/setup-rust-toolchain@v1\n        with:\n          toolchain: nightly\n          cache: false\n\n      - name: Install Rust minimum supported toolchain\n        uses: actions-rust-lang/setup-rust-toolchain@v1\n        with:\n          toolchain: ${{ matrix.toolchain }}\n          cache: false\n  \n      # If you want to use the `rust-cache` action, it's probably a good idea to make your cache key\n      # conditional on the `msrv-pins.toml` file(s) since they will affect the resulting build\n      - name: Rust Cache\n        uses: Swatinem/rust-cache@v2\n        with:\n          key: msrv-pins-files-${{ hashFiles('**/msrv-pins.toml') }}\n\n      - name: Install required tools\n        uses: taiki-e/install-action@v2\n        with:\n          tool: cargo-hack,cargo-minimal-versions,cargo-msrv-prep\n\n      - name: Run checks using cargo-minimal-versions\n        run: |\n          cargo msrv-prep --workspace\n          cargo minimal-versions check --workspace --lib --bins --all-features\n```\n\n## MSRV of `cargo-msrv-prep`\n\nThe MSRV of the `cargo-msrv-prep` tool is Rust **1.79.0**.\nThis is only important when installing from source (e.g. with `cargo install`) however, since the executable will then work with older Rust versions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclechasseur%2Fmsrv-prep","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fclechasseur%2Fmsrv-prep","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclechasseur%2Fmsrv-prep/lists"}