How to determine the minimum supported Rust version for Crate

I developed a crate using the latest version of Rust, but I found that many other crates indicate a minimum supported Rust version of 1.3x. How can I determine the minimum supported version for my crate, or should I fill in the version I used during development :hugs:

You can figure out which Rust versions your code currently works on by installing an old version of the compiler from rustup and running your test suite.

But that's not quite the same thing as your minimum supported version: That's more of a policy statement saying how far back you're willing to check compatibility for, and committing yourself to delaying incorporation of newer Rust features so that people using older compilers can rely on your package.

For most crates, it's perfectly reasonable to say your MSRV is one of:

  • The current stable compiler at the time of release,
  • The stable compiler that was current n months before release, or
  • The particular version you were using when you originally developed the crate
1 Like

Thank you very much for your answer. I understand what to do now :hugs:
If I want to test the MSRV of my crate, I should first check my dependencies(Crate's MSRV)

You can use cargo-msrv to determine your MSRV. It can list the MSRVs of all your dependencies and also check your code against multiple Rust versions to determine the minimum version it compiles with.

2 Likes

Great, this crate is very useful. Thank you :hugs: