The common wisdom is that Rust libraries should support some old Rust compilers. However, just how old is an open question ! Recently rand bumped MSRV to 1.32.0, which was perceived by some as tad too young for such a widely used crate. I wonder if folks can share their experience with this?
The most interesting for me are external constraints (I can’t use rand 0.7 because my distro only ships Rust 1.28), but something like “I maintain library with declared MSRV 1.28” is interesting as well!
As an example, rand was a public dependency of parking lot, which had a lower declared MSRV of 1.31. The recent versions of parking lot don’t depend on rand though, so it’s not a very interesting case.
num-bigint and num-complex have an optional dependency on rand, although they're still on 0.5, since I'll need my own semver-bumps for the public dependency change. I intend to get to that sometime soon.
While I take a conservative stance on MSRV for my crates, I'm willing to shift the blame when it comes to optional dependencies. So for the rand feature, I would just state that MSRV is dictated by the rand crate, and users can complain to you if they're bothered.
$ cargo +1.30.0 build
Updating crates.io index
error: no matching package named `getrandom_package` found
location searched: registry `https://github.com/rust-lang/crates.io-index`
required by package `rand v0.7.0`
Even though the feature isn't enabled, cargo wants to resolve all dependencies, but it doesn't understand the renaming until Cargo 1.31. So I guess I'm stuck with your MSRV at least as far as Cargo.toml compatibility. Source-level compatibility can still be ignored when the feature is disabled.
This would be the group I fall in. regex has a dev-dependency on rand. Long ago, I stopped running tests on the MSRV for that reason, and instead only ran tests on stable/beta/nightly. On the MSRV, I'd just make sure regex could build. However, with rand 0.7, the issue @cuviper described above bit me, such that cargo build after bumping to quickcheck 0.9.0 (and consequently, rand 0.7) would fail. So for now, regex is stuck on quickcheck 0.8 until regex bumps its MSRV. (Which I don't have any plans to do for a while.)
FWIW, older cargo does work if I disable rand's default features (→ "std" → "getrandom"). I may have to see if that minimal set is actually enough for me.
Old Rust versions that don't understand package (crate alias) in Cargo.toml try to fetch getrandom_package. You can register that crate name and replace it with something compatible
Hi, It affected the rust-bitcoin ecosystem(https://github.com/rust-bitcoin) both because "We maintain multiple libraries with declared MSRV 1.22"
and because the reason we do that is to be as close as possible to mrustc supported version(currently 1.19) which is the only way to currently bootstrap rustc.