Skip to content

Commit 2e6a552

Browse files
authored
Remove features "nightly", "small_rng"; remove old deprecated code (#1732)
2 parents 40fe1e9 + 74fa1b4 commit 2e6a552

File tree

11 files changed

+21
-82
lines changed

11 files changed

+21
-82
lines changed

.github/workflows/test.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,18 +104,18 @@ jobs:
104104
- name: Maybe nightly
105105
if: ${{ matrix.toolchain == 'nightly' }}
106106
run: |
107-
cargo test --target ${{ matrix.target }} --features=nightly
107+
cargo test --target ${{ matrix.target }}
108108
cargo test --target ${{ matrix.target }} --all-features
109109
cargo test --target ${{ matrix.target }} --lib --tests --no-default-features
110110
- name: Test rand
111111
run: |
112112
cargo test --target ${{ matrix.target }} --lib --tests --no-default-features
113-
cargo build --target ${{ matrix.target }} --no-default-features --features alloc,sys_rng,small_rng,unbiased
114-
cargo test --target ${{ matrix.target }} --lib --tests --no-default-features --features=alloc,sys_rng,small_rng
113+
cargo build --target ${{ matrix.target }} --no-default-features --features alloc,sys_rng,unbiased
114+
cargo test --target ${{ matrix.target }} --lib --tests --no-default-features --features=alloc,sys_rng
115115
cargo test --target ${{ matrix.target }} --examples
116116
- name: Test rand (all stable features)
117117
run: |
118-
cargo test --target ${{ matrix.target }} --features=serde,log,small_rng
118+
cargo test --target ${{ matrix.target }} --features=serde,log
119119
- name: Test rand_pcg
120120
run: cargo test --target ${{ matrix.target }} --manifest-path rand_pcg/Cargo.toml --features=serde
121121

@@ -146,7 +146,7 @@ jobs:
146146
- name: Test
147147
run: |
148148
# all stable features:
149-
cross test --no-fail-fast --target ${{ matrix.target }} --features=serde,log,small_rng
149+
cross test --no-fail-fast --target ${{ matrix.target }} --features=serde,log
150150
cross test --no-fail-fast --target ${{ matrix.target }} --examples
151151
cross test --no-fail-fast --target ${{ matrix.target }} --manifest-path rand_pcg/Cargo.toml --features=serde
152152
@@ -162,7 +162,7 @@ jobs:
162162
- name: Test rand
163163
run: |
164164
cargo miri test --no-default-features --lib --tests
165-
cargo miri test --features=log,small_rng
165+
cargo miri test --features=log
166166
cargo miri test --manifest-path rand_pcg/Cargo.toml --features=serde
167167
168168
test-no-std:

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,14 @@ You may also find the [Upgrade Guide](https://rust-random.github.io/book/update.
3030

3131
### Removals
3232
- Removed `ReseedingRng` ([#1722])
33+
- Removed unused feature "nightly" ([#1732])
34+
- Removed feature `small_rng` ([#1732])
3335

3436
[#1695]: https://github.com/rust-random/rand/pull/1695
3537
[#1697]: https://github.com/rust-random/rand/pull/1697
3638
[#1717]: https://github.com/rust-random/rand/pull/1717
3739
[#1722]: https://github.com/rust-random/rand/pull/1722
40+
[#1732]: https://github.com/rust-random/rand/pull/1732
3841

3942
## [0.9.2] - 2025-07-20
4043
### Deprecated

Cargo.toml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,11 @@ all-features = true
2424
rustdoc-args = ["--generate-link-to-definition"]
2525

2626
[package.metadata.playground]
27-
features = ["small_rng", "serde"]
27+
features = ["serde"]
2828

2929
[features]
3030
# Meta-features:
31-
default = ["std", "std_rng", "sys_rng", "small_rng", "thread_rng"]
32-
nightly = [] # some additions requiring nightly Rust
31+
default = ["std", "std_rng", "sys_rng", "thread_rng"]
3332
serde = ["dep:serde"]
3433

3534
# Option (enabled by default): without "std" rand uses libcore; this option
@@ -48,9 +47,6 @@ simd_support = []
4847
# Option (enabled by default): enable StdRng
4948
std_rng = ["dep:chacha20"]
5049

51-
# Option: enable SmallRng
52-
small_rng = []
53-
5450
# Option: enable ThreadRng and rng()
5551
thread_rng = ["std", "std_rng", "sys_rng"]
5652

README.md

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -67,27 +67,22 @@ Rand is built with these features enabled by default:
6767
- `alloc` (implied by `std`) enables functionality requiring an allocator
6868
- `sys_rng` (implied by `std`) enables `rngs::SysRng`, using the [getrandom] crate
6969
- `std_rng` enables inclusion of `StdRng`, `ThreadRng`
70-
- `small_rng` enables inclusion of the `SmallRng` PRNG
7170

7271
Optionally, the following dependencies can be enabled:
7372

7473
- `log` enables logging via [log](https://crates.io/crates/log)
7574

7675
Additionally, these features configure Rand:
7776

78-
- `nightly` includes some additions requiring nightly Rust
79-
- `simd_support` (experimental) enables sampling of SIMD values
80-
(uniformly random SIMD integers and floats), requiring nightly Rust
77+
- `simd_support` (experimental) enables sampling of SIMD values (uniformly
78+
random SIMD integers and floats). Since `std::simd` is not yet stable this
79+
feature requires nightly Rust and may cause build failures.
8180
- `unbiased` use unbiased sampling for algorithms supporting this option: Uniform distribution.
8281

8382
(By default, bias affecting no more than one in 2^48 samples is accepted.)
8483

8584
Note: enabling this option is expected to affect reproducibility of results.
8685

87-
Note that nightly features are not stable and therefore not all library and
88-
compiler versions will be compatible. This is especially true of Rand's
89-
experimental `simd_support` feature.
90-
9186
Rand supports limited functionality in `no_std` mode (enabled via
9287
`default-features = false`). In this case, `SysRng` is
9388
unavailable (unless `sys_rng` is enabled), large parts of `seq` are

benches/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ simd_support = ["rand/simd_support"]
1111
[dependencies]
1212

1313
[dev-dependencies]
14-
rand = { path = "..", features = ["small_rng", "nightly"] }
14+
rand = { path = ".." }
1515
rand_pcg = { path = "../rand_pcg" }
1616
chacha20 = { version = "0.10.0-rc.10", default-features = false, features = ["rng"] }
1717
criterion = "0.5"

src/lib.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -85,16 +85,6 @@ pub mod seq;
8585
#[cfg(feature = "thread_rng")]
8686
pub use crate::rngs::thread::rng;
8787

88-
/// Access the thread-local generator
89-
///
90-
/// Use [`rand::rng()`](rng()) instead.
91-
#[cfg(feature = "thread_rng")]
92-
#[deprecated(since = "0.9.0", note = "Renamed to `rng`")]
93-
#[inline]
94-
pub fn thread_rng() -> crate::rngs::ThreadRng {
95-
rng()
96-
}
97-
9888
pub use rng::{Fill, RngExt};
9989

10090
#[cfg(feature = "thread_rng")]

src/prelude.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
2121
#[doc(no_inline)]
2222
pub use crate::distr::Distribution;
23-
#[cfg(feature = "small_rng")]
2423
#[doc(no_inline)]
2524
pub use crate::rngs::SmallRng;
2625
#[cfg(feature = "std_rng")]

src/rng.rs

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -312,44 +312,6 @@ pub trait RngExt: Rng {
312312
fn fill<T: Fill>(&mut self, dest: &mut [T]) {
313313
Fill::fill_slice(dest, self)
314314
}
315-
316-
/// Alias for [`RngExt::random`].
317-
#[inline]
318-
#[deprecated(
319-
since = "0.9.0",
320-
note = "Renamed to `random` to avoid conflict with the new `gen` keyword in Rust 2024."
321-
)]
322-
fn r#gen<T>(&mut self) -> T
323-
where
324-
StandardUniform: Distribution<T>,
325-
{
326-
self.random()
327-
}
328-
329-
/// Alias for [`RngExt::random_range`].
330-
#[inline]
331-
#[deprecated(since = "0.9.0", note = "Renamed to `random_range`")]
332-
fn gen_range<T, R>(&mut self, range: R) -> T
333-
where
334-
T: SampleUniform,
335-
R: SampleRange<T>,
336-
{
337-
self.random_range(range)
338-
}
339-
340-
/// Alias for [`RngExt::random_bool`].
341-
#[inline]
342-
#[deprecated(since = "0.9.0", note = "Renamed to `random_bool`")]
343-
fn gen_bool(&mut self, p: f64) -> bool {
344-
self.random_bool(p)
345-
}
346-
347-
/// Alias for [`RngExt::random_ratio`].
348-
#[inline]
349-
#[deprecated(since = "0.9.0", note = "Renamed to `random_ratio`")]
350-
fn gen_ratio(&mut self, numerator: u32, denominator: u32) -> bool {
351-
self.random_ratio(numerator, denominator)
352-
}
353315
}
354316

355317
impl<R: Rng + ?Sized> RngExt for R {}

src/rngs/mod.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,23 +94,17 @@
9494
//! [PCG]: https://www.pcg-random.org/
9595
//! [xoshiro]: https://prng.di.unimi.it/
9696
97-
#[cfg(feature = "small_rng")]
9897
mod small;
99-
#[cfg(feature = "small_rng")]
10098
mod xoshiro128plusplus;
101-
#[cfg(feature = "small_rng")]
10299
mod xoshiro256plusplus;
103100

104101
#[cfg(feature = "std_rng")]
105102
mod std;
106103
#[cfg(feature = "thread_rng")]
107104
pub(crate) mod thread;
108105

109-
#[cfg(feature = "small_rng")]
110106
pub use self::small::SmallRng;
111-
#[cfg(feature = "small_rng")]
112107
pub use xoshiro128plusplus::Xoshiro128PlusPlus;
113-
#[cfg(feature = "small_rng")]
114108
pub use xoshiro256plusplus::Xoshiro256PlusPlus;
115109

116110
#[cfg(feature = "std_rng")]

src/seq/iterator.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ pub trait IteratorRandom: Iterator + Sized {
263263
}
264264

265265
/// Deprecated: use [`Self::sample_fill`] instead
266-
#[deprecated(since = "0.9.2", note = "Renamed to `sample_fill`")]
266+
#[deprecated(since = "0.10.0", note = "Renamed to `sample_fill`")]
267267
fn choose_multiple_fill<R>(self, rng: &mut R, buf: &mut [Self::Item]) -> usize
268268
where
269269
R: Rng + ?Sized,
@@ -273,7 +273,7 @@ pub trait IteratorRandom: Iterator + Sized {
273273

274274
/// Deprecated: use [`Self::sample`] instead
275275
#[cfg(feature = "alloc")]
276-
#[deprecated(since = "0.9.2", note = "Renamed to `sample`")]
276+
#[deprecated(since = "0.10.0", note = "Renamed to `sample`")]
277277
fn choose_multiple<R>(self, rng: &mut R, amount: usize) -> Vec<Self::Item>
278278
where
279279
R: Rng + ?Sized,

0 commit comments

Comments
 (0)