Skip to content

Commit d4a825d

Browse files
Use explicit features rather than implicit.
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. This does mean that some previously publicly visible features are now gone, like `serde`. These features would not have worked previously as the code is guarded by, for example, checks for `feature = "serde1"`, so just enabling the optional dependency wouldn't have been sufficient to enable the code.
1 parent 1e381d1 commit d4a825d

File tree

5 files changed

+11
-6
lines changed

5 files changed

+11
-6
lines changed

Cargo.toml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ features = ["small_rng", "serde1"]
3030
# Meta-features:
3131
default = ["std", "std_rng", "getrandom", "small_rng"]
3232
nightly = [] # some additions requiring nightly Rust
33-
serde1 = ["serde", "rand_core/serde1"]
33+
serde1 = ["dep:serde", "rand_core/serde1"]
3434

3535
# Option (enabled by default): without "std" rand uses libcore; this option
3636
# enables functionality expected to be available on a standard platform.
@@ -46,7 +46,7 @@ getrandom = ["rand_core/getrandom"]
4646
simd_support = ["zerocopy/simd-nightly"]
4747

4848
# Option (enabled by default): enable StdRng
49-
std_rng = ["rand_chacha"]
49+
std_rng = ["dep:rand_chacha"]
5050

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

59+
# Option: enable logging
60+
log = ["dep:log"]
61+
5962
[workspace]
6063
members = [
6164
"rand_core",

rand_chacha/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,4 @@ rand_core = { path = "../rand_core", version = "=0.9.0-alpha.1", features = ["ge
3333
default = ["std"]
3434
getrandom = ["rand_core/getrandom"]
3535
std = ["ppv-lite86/std", "rand_core/std"]
36-
serde1 = ["serde"]
36+
serde1 = ["dep:serde"]

rand_core/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ all-features = true
2727
[features]
2828
std = ["alloc", "getrandom?/std"]
2929
alloc = [] # enables Vec and Box support without std
30-
serde1 = ["serde"] # enables serde for BlockRng wrapper
30+
getrandom = ["dep:getrandom"]
31+
serde1 = ["dep:serde"] # enables serde for BlockRng wrapper
3132

3233
[dependencies]
3334
serde = { version = "1", features = ["derive"], optional = true }

rand_distr/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ alloc = ["rand/alloc"]
2929
# feature (default-enabled) will have the same effect.
3030
std_math = ["num-traits/std"]
3131

32-
serde1 = ["serde", "rand/serde1"]
32+
serde1 = ["dep:serde", "rand/serde1"]
33+
serde_with = ["dep:serde_with"]
3334

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

rand_pcg/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ all-features = true
2020
rustdoc-args = ["--generate-link-to-definition"]
2121

2222
[features]
23-
serde1 = ["serde"]
23+
serde1 = ["dep:serde"]
2424
getrandom = ["rand_core/getrandom"]
2525

2626
[dependencies]

0 commit comments

Comments
 (0)