From 2907d9bc2f162dad3a579eb1e2c98cc85848544d Mon Sep 17 00:00:00 2001 From: Bruno Kirschner Date: Wed, 30 Oct 2019 10:54:33 +0100 Subject: [PATCH] Introduce `ahash-compile-time-rng` feature. Disables the default features of `ahash` and reintroduces them through a new feature called `ahash-compile-time-rng`, which is enabled by default. The new feature makes it possible for depended crates to rely on `hashbrown` with `ahash` as default hasher and to disable the `compile-time-rng` at the same time. This might be useful for any dependent crate targeting `no_std`, which contains `rand` or `rand_core` somewhere inside the dependency tree as a bug in cargo accidentally enables the underlying `getrandom` feature if `compile-time-rng` is enabled [1]. ... fixes #124 [1] https://github.com/rust-lang/cargo/issues/5760 --- Cargo.toml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 3e6fc93d5d..995d84ab94 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,7 +14,7 @@ build = "build.rs" [dependencies] # For the default hasher -ahash = { version = "0.2.11", optional = true } +ahash = { version = "0.2.11", optional = true, default-features = false } # For external trait impls rayon = { version = "1.0", optional = true } @@ -37,7 +37,13 @@ serde_test = "1.0" doc-comment = "0.3.1" [features] -default = ["ahash", "inline-more"] +default = [ + "ahash", + "ahash-compile-time-rng", + "inline-more", +] + +ahash-compile-time-rng = [ "ahash/compile-time-rng" ] nightly = [] rustc-internal-api = [] rustc-dep-of-std = ["nightly", "core", "compiler_builtins", "alloc", "rustc-internal-api"]