Determine appropriate rust-version

I'm curious how crate maintainers determine what to set rust-version to.

For some cases it's completely obvious, like when I've used format!("{blah}") -- or some other recent and obvious feature. But in some cases I have crates only using things that, to me, have existed ever since the universe was created.

I realize there's logically no point in setting rust-version to anything older that the rust version where the support for rust-version was introduced -- but say you're a stickler for this kind of thing and want to set the right version.. The brute force way to download all stable versions and run a script that tests the crate with all stable versions.

How do you do it? Heuristics? Brute force? Pick an aesthetically pleasing version number?

Well, lib.rs does the almost-brute-force for most crates (they also look for some known features, AFAIK, so that the brute force doesn't have to check every version existing), e.g. the information on serde (MSRV column at the right). In many cases, it's probably enough to get a lower-bound from there, as a maximum MSRV of all dependencies, and check up from it.

1 Like