@@ -20,6 +20,11 @@ rustdoc-args = ["--cfg", "getrandom_backend=\"extern_impl\""]
2020# use std to retrieve OS error descriptions
2121std = []
2222
23+ # Feature to enable deterministic testing -- has an MSRV of 1.85
24+ #
25+ # WARNING: This should only be enabled in dev-dependencies as it is for deterministic testing only.
26+ unsafe_deterministic_testing = [" dep:rand_core" , " dep:chacha20" ]
27+
2328# Optional backend: wasm_js
2429#
2530# This flag enables the wasm_js backend and uses it by default on wasm32 where
@@ -44,6 +49,11 @@ rand_core = { version = "0.10.0", optional = true }
4449[target .'cfg(all(any(target_os = "linux", target_os = "android"), not(any(all(target_os = "linux", target_env = ""), getrandom_backend = "custom", getrandom_backend = "linux_raw", getrandom_backend = "rdrand", getrandom_backend = "rndr"))))' .dependencies ]
4550libc = { version = " 0.2.154" , default-features = false }
4651
52+ # deterministic_testing
53+ [target .'cfg(getrandom_backend = "deterministic_testing")' .dependencies ]
54+ chacha20 = { version = " 0.10.0" , features = [" rng" ], optional = true }
55+
56+
4757# apple-other
4858[target .'cfg(any(target_os = "ios", target_os = "visionos", target_os = "watchos", target_os = "tvos"))' .dependencies ]
4959libc = { version = " 0.2.154" , default-features = false }
@@ -96,7 +106,7 @@ wasm-bindgen-test = "0.3"
96106[lints .rust .unexpected_cfgs ]
97107level = " warn"
98108check-cfg = [
99- ' cfg(getrandom_backend, values("custom", "efi_rng", "rdrand", "rndr", "linux_getrandom", "linux_raw", "windows_legacy", "unsupported", "extern_impl"))' ,
109+ ' cfg(getrandom_backend, values("custom", "efi_rng", "rdrand", "rndr", "linux_getrandom", "linux_raw", "windows_legacy", "unsupported", "extern_impl", "deterministic_testing" ))' ,
100110 ' cfg(getrandom_msan)' ,
101111 ' cfg(getrandom_test_linux_fallback)' ,
102112 ' cfg(getrandom_test_linux_without_fallback)' ,
0 commit comments