diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4cf4131a3a..a6d47d800f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -104,18 +104,18 @@ jobs: - name: Maybe nightly if: ${{ matrix.toolchain == 'nightly' }} run: | - cargo test --target ${{ matrix.target }} --features=nightly + cargo test --target ${{ matrix.target }} cargo test --target ${{ matrix.target }} --all-features cargo test --target ${{ matrix.target }} --lib --tests --no-default-features - name: Test rand run: | cargo test --target ${{ matrix.target }} --lib --tests --no-default-features - cargo build --target ${{ matrix.target }} --no-default-features --features alloc,sys_rng,small_rng,unbiased - cargo test --target ${{ matrix.target }} --lib --tests --no-default-features --features=alloc,sys_rng,small_rng + cargo build --target ${{ matrix.target }} --no-default-features --features alloc,sys_rng,unbiased + cargo test --target ${{ matrix.target }} --lib --tests --no-default-features --features=alloc,sys_rng cargo test --target ${{ matrix.target }} --examples - name: Test rand (all stable features) run: | - cargo test --target ${{ matrix.target }} --features=serde,log,small_rng + cargo test --target ${{ matrix.target }} --features=serde,log - name: Test rand_pcg run: cargo test --target ${{ matrix.target }} --manifest-path rand_pcg/Cargo.toml --features=serde @@ -146,7 +146,7 @@ jobs: - name: Test run: | # all stable features: - cross test --no-fail-fast --target ${{ matrix.target }} --features=serde,log,small_rng + cross test --no-fail-fast --target ${{ matrix.target }} --features=serde,log cross test --no-fail-fast --target ${{ matrix.target }} --examples cross test --no-fail-fast --target ${{ matrix.target }} --manifest-path rand_pcg/Cargo.toml --features=serde @@ -162,7 +162,7 @@ jobs: - name: Test rand run: | cargo miri test --no-default-features --lib --tests - cargo miri test --features=log,small_rng + cargo miri test --features=log cargo miri test --manifest-path rand_pcg/Cargo.toml --features=serde test-no-std: diff --git a/CHANGELOG.md b/CHANGELOG.md index c341f0e50a..2d9bc5854e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,11 +30,14 @@ You may also find the [Upgrade Guide](https://rust-random.github.io/book/update. ### Removals - Removed `ReseedingRng` ([#1722]) +- Removed unused feature "nightly" ([#1732]) +- Removed feature `small_rng` ([#1732]) [#1695]: https://github.com/rust-random/rand/pull/1695 [#1697]: https://github.com/rust-random/rand/pull/1697 [#1717]: https://github.com/rust-random/rand/pull/1717 [#1722]: https://github.com/rust-random/rand/pull/1722 +[#1732]: https://github.com/rust-random/rand/pull/1732 ## [0.9.2] - 2025-07-20 ### Deprecated diff --git a/Cargo.toml b/Cargo.toml index d8ec1e90a7..d2bf798037 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,12 +24,11 @@ all-features = true rustdoc-args = ["--generate-link-to-definition"] [package.metadata.playground] -features = ["small_rng", "serde"] +features = ["serde"] [features] # Meta-features: -default = ["std", "std_rng", "sys_rng", "small_rng", "thread_rng"] -nightly = [] # some additions requiring nightly Rust +default = ["std", "std_rng", "sys_rng", "thread_rng"] serde = ["dep:serde"] # Option (enabled by default): without "std" rand uses libcore; this option @@ -48,9 +47,6 @@ simd_support = [] # Option (enabled by default): enable StdRng std_rng = ["dep:chacha20"] -# Option: enable SmallRng -small_rng = [] - # Option: enable ThreadRng and rng() thread_rng = ["std", "std_rng", "sys_rng"] diff --git a/README.md b/README.md index 662f3678ad..7f35640765 100644 --- a/README.md +++ b/README.md @@ -67,7 +67,6 @@ Rand is built with these features enabled by default: - `alloc` (implied by `std`) enables functionality requiring an allocator - `sys_rng` (implied by `std`) enables `rngs::SysRng`, using the [getrandom] crate - `std_rng` enables inclusion of `StdRng`, `ThreadRng` -- `small_rng` enables inclusion of the `SmallRng` PRNG Optionally, the following dependencies can be enabled: @@ -75,19 +74,15 @@ Optionally, the following dependencies can be enabled: Additionally, these features configure Rand: -- `nightly` includes some additions requiring nightly Rust -- `simd_support` (experimental) enables sampling of SIMD values - (uniformly random SIMD integers and floats), requiring nightly Rust +- `simd_support` (experimental) enables sampling of SIMD values (uniformly + random SIMD integers and floats). Since `std::simd` is not yet stable this + feature requires nightly Rust and may cause build failures. - `unbiased` use unbiased sampling for algorithms supporting this option: Uniform distribution. (By default, bias affecting no more than one in 2^48 samples is accepted.) Note: enabling this option is expected to affect reproducibility of results. -Note that nightly features are not stable and therefore not all library and -compiler versions will be compatible. This is especially true of Rand's -experimental `simd_support` feature. - Rand supports limited functionality in `no_std` mode (enabled via `default-features = false`). In this case, `SysRng` is unavailable (unless `sys_rng` is enabled), large parts of `seq` are diff --git a/benches/Cargo.toml b/benches/Cargo.toml index 3cc70c1690..c5b4b79835 100644 --- a/benches/Cargo.toml +++ b/benches/Cargo.toml @@ -11,7 +11,7 @@ simd_support = ["rand/simd_support"] [dependencies] [dev-dependencies] -rand = { path = "..", features = ["small_rng", "nightly"] } +rand = { path = ".." } rand_pcg = { path = "../rand_pcg" } chacha20 = { version = "0.10.0-rc.10", default-features = false, features = ["rng"] } criterion = "0.5" diff --git a/src/lib.rs b/src/lib.rs index 1619194c36..eb7cd8459b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -85,16 +85,6 @@ pub mod seq; #[cfg(feature = "thread_rng")] pub use crate::rngs::thread::rng; -/// Access the thread-local generator -/// -/// Use [`rand::rng()`](rng()) instead. -#[cfg(feature = "thread_rng")] -#[deprecated(since = "0.9.0", note = "Renamed to `rng`")] -#[inline] -pub fn thread_rng() -> crate::rngs::ThreadRng { - rng() -} - pub use rng::{Fill, RngExt}; #[cfg(feature = "thread_rng")] diff --git a/src/prelude.rs b/src/prelude.rs index a4fb3c7838..1661925a1d 100644 --- a/src/prelude.rs +++ b/src/prelude.rs @@ -20,7 +20,6 @@ #[doc(no_inline)] pub use crate::distr::Distribution; -#[cfg(feature = "small_rng")] #[doc(no_inline)] pub use crate::rngs::SmallRng; #[cfg(feature = "std_rng")] diff --git a/src/rng.rs b/src/rng.rs index 7bd813434b..f25e6731ba 100644 --- a/src/rng.rs +++ b/src/rng.rs @@ -312,44 +312,6 @@ pub trait RngExt: Rng { fn fill(&mut self, dest: &mut [T]) { Fill::fill_slice(dest, self) } - - /// Alias for [`RngExt::random`]. - #[inline] - #[deprecated( - since = "0.9.0", - note = "Renamed to `random` to avoid conflict with the new `gen` keyword in Rust 2024." - )] - fn r#gen(&mut self) -> T - where - StandardUniform: Distribution, - { - self.random() - } - - /// Alias for [`RngExt::random_range`]. - #[inline] - #[deprecated(since = "0.9.0", note = "Renamed to `random_range`")] - fn gen_range(&mut self, range: R) -> T - where - T: SampleUniform, - R: SampleRange, - { - self.random_range(range) - } - - /// Alias for [`RngExt::random_bool`]. - #[inline] - #[deprecated(since = "0.9.0", note = "Renamed to `random_bool`")] - fn gen_bool(&mut self, p: f64) -> bool { - self.random_bool(p) - } - - /// Alias for [`RngExt::random_ratio`]. - #[inline] - #[deprecated(since = "0.9.0", note = "Renamed to `random_ratio`")] - fn gen_ratio(&mut self, numerator: u32, denominator: u32) -> bool { - self.random_ratio(numerator, denominator) - } } impl RngExt for R {} diff --git a/src/rngs/mod.rs b/src/rngs/mod.rs index a9b5566b18..51b107fd08 100644 --- a/src/rngs/mod.rs +++ b/src/rngs/mod.rs @@ -94,11 +94,8 @@ //! [PCG]: https://www.pcg-random.org/ //! [xoshiro]: https://prng.di.unimi.it/ -#[cfg(feature = "small_rng")] mod small; -#[cfg(feature = "small_rng")] mod xoshiro128plusplus; -#[cfg(feature = "small_rng")] mod xoshiro256plusplus; #[cfg(feature = "std_rng")] @@ -106,11 +103,8 @@ mod std; #[cfg(feature = "thread_rng")] pub(crate) mod thread; -#[cfg(feature = "small_rng")] pub use self::small::SmallRng; -#[cfg(feature = "small_rng")] pub use xoshiro128plusplus::Xoshiro128PlusPlus; -#[cfg(feature = "small_rng")] pub use xoshiro256plusplus::Xoshiro256PlusPlus; #[cfg(feature = "std_rng")] diff --git a/src/seq/iterator.rs b/src/seq/iterator.rs index f257b4e599..b2a8c1fa02 100644 --- a/src/seq/iterator.rs +++ b/src/seq/iterator.rs @@ -263,7 +263,7 @@ pub trait IteratorRandom: Iterator + Sized { } /// Deprecated: use [`Self::sample_fill`] instead - #[deprecated(since = "0.9.2", note = "Renamed to `sample_fill`")] + #[deprecated(since = "0.10.0", note = "Renamed to `sample_fill`")] fn choose_multiple_fill(self, rng: &mut R, buf: &mut [Self::Item]) -> usize where R: Rng + ?Sized, @@ -273,7 +273,7 @@ pub trait IteratorRandom: Iterator + Sized { /// Deprecated: use [`Self::sample`] instead #[cfg(feature = "alloc")] - #[deprecated(since = "0.9.2", note = "Renamed to `sample`")] + #[deprecated(since = "0.10.0", note = "Renamed to `sample`")] fn choose_multiple(self, rng: &mut R, amount: usize) -> Vec where R: Rng + ?Sized, diff --git a/src/seq/slice.rs b/src/seq/slice.rs index 6c17f713ec..1b8a068eae 100644 --- a/src/seq/slice.rs +++ b/src/seq/slice.rs @@ -279,7 +279,7 @@ pub trait IndexedRandom: Index { /// Deprecated: use [`Self::sample`] instead #[cfg(feature = "alloc")] - #[deprecated(since = "0.9.2", note = "Renamed to `sample`")] + #[deprecated(since = "0.10.0", note = "Renamed to `sample`")] fn choose_multiple( &self, rng: &mut R, @@ -293,7 +293,7 @@ pub trait IndexedRandom: Index { } /// Deprecated: use [`Self::sample_array`] instead - #[deprecated(since = "0.9.2", note = "Renamed to `sample_array`")] + #[deprecated(since = "0.10.0", note = "Renamed to `sample_array`")] fn choose_multiple_array(&self, rng: &mut R) -> Option<[Self::Output; N]> where Self::Output: Clone + Sized, @@ -304,7 +304,7 @@ pub trait IndexedRandom: Index { /// Deprecated: use [`Self::sample_weighted`] instead #[cfg(feature = "std")] - #[deprecated(since = "0.9.2", note = "Renamed to `sample_weighted`")] + #[deprecated(since = "0.10.0", note = "Renamed to `sample_weighted`")] fn choose_multiple_weighted( &self, rng: &mut R, @@ -536,7 +536,7 @@ impl<'a, S: Index + ?Sized + 'a, T: 'a> ExactSizeIterator /// Deprecated: renamed to [`IndexedSamples`] #[cfg(feature = "alloc")] -#[deprecated(since = "0.9.2", note = "Renamed to `IndexedSamples`")] +#[deprecated(since = "0.10.0", note = "Renamed to `IndexedSamples`")] pub type SliceChooseIter<'a, S, T> = IndexedSamples<'a, S, T>; #[cfg(test)]