A few issues and PRs (#279#281) have brought up the idea of increasing the MSRV of this crate. Currently the MSRV is 1.34, and I've seen 3 features we might want to use which are only present in later versions:
MaybeUninit: added in 1.36 (Released 2019-07-04)<*mut T>::cast: added in 1.38 (Released 2019-09-26)- Const Generics: Added in 1.51 (Released 2021-03-25)
When raising the MSRV, we should keep in mind that rand 0.8 and rand_core 0.6 have an MSRV of 1.36, and they are our largest users. Other top crates that directly depend on us include:
Also, we can always use rustversion to have APIs that require a newer version of Rust without increasing our MSRV, provided we can implement the newer API in terms of one of the older APIs.
I would propose: raising the MSRV to 1.36 so we can use MaybeUninit inside of our crate.
For example,
pubfngetrandom_uninit(buf:&mut[MaybeUninit<u8>]) -> Result<&[u8],Error>{// Unconditionally use MaybeUninit// ...}#[rustversion::since(1.51)]#[inline]pubfngetrandom_array<constN:usize>() -> Result<[u8;N],Error>{letmut arr:[MaybeUninit<u8>;N] = [MaybeUninit;;uninit();N];let s:&mut[u8;N] = getrandom_uninit(&mut arr)?.try_into().unwrap();Ok(*s)}
A few issues and PRs (#279#281) have brought up the idea of increasing the MSRV of this crate. Currently the MSRV is 1.34, and I've seen 3 features we might want to use which are only present in later versions:
MaybeUninit: added in 1.36 (Released 2019-07-04)<*mut T>::cast: added in 1.38 (Released 2019-09-26)When raising the MSRV, we should keep in mind that
rand 0.8andrand_core 0.6have an MSRV of 1.36, and they are our largest users. Other top crates that directly depend on us include:uuid: MSRV 1.57ahash: MSRV 1.43.1fastrand: MSRV 1.34 (but it's only adevdependancy)os_str_bytes: MSRV 1.57redox_users: MSRV at least 1.36async-io: MSRV 1.46zip: MSRV 1.54Also, we can always use
rustversionto have APIs that require a newer version of Rust without increasing our MSRV, provided we can implement the newer API in terms of one of the older APIs.I would propose: raising the MSRV to 1.36 so we can use
MaybeUninitinside of our crate.For example,