Skip to content

Commit

Permalink
Use explicit features rather than implicit.
Browse files Browse the repository at this point in the history
In Rust 2024 edition, implicit features from optional dependencies
are going away and explicit features are required.

This changes all features using optional dependencies to use the
"dep:" syntax to avoid creating implicit features.

It also adds new explicit features for optional dependencies that
didn't previously have an explicit feature to enable them.

One user-visible implicit feature has now been removed:
`rand` no longer has an implicit feature `rand_chacha`
as that is enabled by `std_rng`.
  • Loading branch information
waywardmonkeys committed Jul 26, 2024
1 parent f7bbcca commit 718d7d4
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ You may also find the [Upgrade Guide](https://rust-random.github.io/book/update.
- Fix portability of `rand::distributions::Slice` (#1469)
- Rename `rand::distributions` to `rand::distr` (#1470)
- The `serde1` feature has been renamed `serde` (#1477)
- Remove implicit feature `rand_chacha`. This is enabled by `std_rng`. (#1473)

## [0.9.0-alpha.1] - 2024-03-18
- Add the `Slice::num_choices` method to the Slice distribution (#1402)
Expand Down
5 changes: 4 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ getrandom = ["rand_core/getrandom"]
simd_support = ["zerocopy/simd-nightly"]

# Option (enabled by default): enable StdRng
std_rng = ["rand_chacha"]
std_rng = ["dep:rand_chacha"]

# Option: enable SmallRng
small_rng = []
Expand All @@ -56,6 +56,9 @@ small_rng = []
# Note: enabling this option is expected to affect reproducibility of results.
unbiased = []

# Option: enable logging
log = ["dep:log"]

[workspace]
members = [
"rand_core",
Expand Down
1 change: 1 addition & 0 deletions rand_core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ all-features = true
[features]
std = ["alloc", "getrandom?/std"]
alloc = [] # enables Vec and Box support without std
getrandom = ["dep:getrandom"]
serde = ["dep:serde"] # enables serde for BlockRng wrapper

[dependencies]
Expand Down
1 change: 1 addition & 0 deletions rand_distr/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ alloc = ["rand/alloc"]
std_math = ["num-traits/std"]

serde = ["dep:serde", "rand/serde"]
serde_with = ["dep:serde_with"]

[dependencies]
rand = { path = "..", version = "=0.9.0-alpha.1", default-features = false }
Expand Down

0 comments on commit 718d7d4

Please sign in to comment.