rust-random / rand

A Rust library for random number generation.
https://crates.io/crates/rand
Other
1.6k stars 423 forks source link

Cleaner README, remove MSRV shields #1417

Closed dhardy closed 3 months ago

dhardy commented 3 months ago

This reduces the MSRV to one place: the top Cargo.toml.

newpavlov commented 3 months ago

On a somewhat relevant note: it may be worth to consider moving rand into its own folder and use virtual manifest for workspace.

dhardy commented 3 months ago

MSRV of crates also may evolve differently

I take the view that if it isn't tested, it doesn't work, and we only have one CI test for MSRV. We've been using a common policy across this repo for a while already.

I suspect rand_core and RNG crates may work with a lower rustc, but don't really care; half our deps now require a higher MSRV anyway (at least if you count dev deps).

newpavlov commented 3 months ago

It's matter of bumping MSRV in future, e.g. why should MSRV bump for rand_distr bump MSRV for rand? Yes, different crate MSRVs would require some CI changes, but it's nothing impossible.

Also, I don't think that this:

edition.workspace = true
rust-version.workspace = true

is cleaner than this:

edition = "2021"
rust-version = "1.61"

Yes, it helps with bumping MSRV/edition, but we do it quite rarely, while user often look into Cargo.toml for information about crate and such indirection only wastes their time.

dhardy commented 3 months ago

It's matter of bumping MSRV in future,

It doesn't prevent that.

Also, I don't think that this: ... is cleaner than this:

No. The only advantage is making those values easier to change.

Bevy have a cleaner set-up, but I couldn't find doc on how it works and .workspace = true was needed in testing...

Either way, this stuff isn't very important.

vks commented 3 months ago

it also wasn't accurate since rust-version prevents older rust versions from attempting to compile the code-base.

I don't think so, older Rust versions will just ignore rust-version and print a warning.

I agree makes sense to have the same MSRV for all crates if that is what we are testing. If the MSRVs diverge, it should be reflected by the CI, and we can still change that later.

dhardy commented 3 months ago

Workspace inheritance was only stabilised in 1.64 so we can't do that yet.

We should probably still link the upgrade guide?

Done.

I don't think so, older Rust versions will just ignore rust-version and print a warning.

No (at least not since versions which support rust-version).

$ cargo +1.60 test
error: package `rand_core v0.9.0-alpha.1 (..)` cannot be built because it requires rustc 1.61 or newer, while the currently active rustc version is 1.60.0