Skip to content

Commit efb6ede

Browse files
committed
Limit dev_urandom_fallback to Linux.
1 parent 7b0f9ad commit efb6ede

File tree

2 files changed

+11
-20
lines changed

2 files changed

+11
-20
lines changed

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ cc = "1.0.26"
321321
[features]
322322
# These features are documented in the top-level module's documentation.
323323
default = ["use_heap", "dev_urandom_fallback"]
324-
dev_urandom_fallback = []
324+
dev_urandom_fallback = ["use_heap"]
325325
internal_benches = []
326326
slow_tests = []
327327
test_logging = []

src/rand.rs

+10-19
Original file line numberDiff line numberDiff line change
@@ -97,18 +97,6 @@ impl SecureRandom for SystemRandom {
9797

9898
impl sealed::Sealed for SystemRandom {}
9999

100-
#[cfg(all(
101-
feature = "use_heap",
102-
not(any(
103-
target_os = "linux",
104-
target_os = "macos",
105-
target_os = "ios",
106-
target_os = "fuchsia",
107-
windows
108-
))
109-
))]
110-
use self::urandom::fill as fill_impl;
111-
112100
#[cfg(any(
113101
all(target_os = "linux", not(feature = "dev_urandom_fallback")),
114102
windows
@@ -201,14 +189,17 @@ mod sysrand {
201189
}
202190
}
203191

192+
#[cfg(target_arch = "wasm32")]
193+
mod sysrand {
194+
use crate::error;
195+
196+
pub fn fill(_dest: &mut [u8]) -> Result<(), error::Unspecified> {
197+
unimplemented!()
198+
}
199+
}
200+
204201
// Keep the `cfg` conditions in sync with the conditions in lib.rs.
205-
#[cfg(all(
206-
feature = "use_heap",
207-
any(target_os = "redox", unix),
208-
not(any(target_os = "macos", target_os = "ios")),
209-
not(all(target_os = "linux", not(feature = "dev_urandom_fallback"))),
210-
not(any(target_os = "fuchsia")),
211-
))]
202+
#[cfg(all(target_os = "linux", feature = "dev_urandom_fallback"))]
212203
mod urandom {
213204
use crate::error;
214205

0 commit comments

Comments
 (0)