Safeguard
Developer Tools•

Can an MSRV setting stop you from getting security patches?

The rust-version field sets a minimum Rust version. Learn how it affects dependency selection, and why an old MSRV can block fixed releases of crates.

Safeguard Security Team
3 min read

It can. The rust-version field in Cargo.toml tells Cargo the minimum Rust version your package supports, and tooling may use it when choosing dependency versions. If your MSRV lags far behind, a fixed release that needs a newer compiler may be skipped or fail to build.

What the field does

The Cargo reference says rust-version is an optional key that tells Cargo what version of the Rust language and compiler your package can be compiled with. If the compiler in use is older than that, Cargo errors rather than starting the build. A user can opt in to an unsupported build with the ignore rust version flag.

The reference also says cargo add selects the latest dependency version that is compatible with your rust-version, and tells you when that is not the latest. The resolver may take the Rust version into account when picking dependencies, and an incompatible rust version policy can be set to prefer a fallback.

How this collides with security

Say a crate fixes a vulnerability in version 2.4.1, and that release requires a newer compiler than your rust-version allows. A resolver that respects your MSRV may keep you on the vulnerable 2.4.0. Nothing looks broken. Your build is green and your lockfile is stable.

The reference states it is not expected that a dependency specification excludes versions incompatible with your rust-version, so the lockfile is where the choice shows up.

A policy that keeps patches flowing

  1. Pick an MSRV policy with a clear rule, for example following the stable release by a fixed number of releases, and write it down.
  2. Review the policy on a schedule. The reference says the further the rust-version drifts from your stated policy, the harder it gets to adopt dependency updates.
  3. When an advisory fix needs a newer compiler, decide in the open: raise the MSRV, or backport, or accept the risk with an owner and a date.
  4. Treat raising rust-version as a conscious change. The reference notes it is assumed to be a minor incompatibility.
  5. In CI, build with both the declared MSRV and the current stable release.

Library or application

Applications control their own toolchain, so the MSRV is often just the toolchain you ship with. Libraries are different. A library with a very old MSRV forces its users to accept old dependencies too. Pick a policy that does not trap your downstream users on unpatched code.

How to spot the problem

Run the update dry run from how to preview cargo update and compare the proposed versions with the latest published ones. If a crate is held back and an advisory lists a newer fixed version, MSRV is a likely cause.

Safeguard's dependency scanning flags known vulnerable versions in your lockfile, so a held back crate shows up as a finding. Try the free scan at gold.safeguard.sh/scan.

Quick check

Does rust-version change what Cargo resolves?

It can. The Cargo reference says the resolver may take the Rust version into account when picking dependencies.

Can I build anyway with an older compiler?

Yes, with the ignore rust version flag, but the package is then unsupported on that compiler.

Sources

Last reviewed: 19 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.