Skip to content

Commit 42247d8

Browse files
committed
Restrict rand::rngs::adapter to std
See #911.
1 parent fbcfa22 commit 42247d8

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

src/rngs/adapter/mod.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@
88

99
//! Wrappers / adapters forming RNGs
1010
11-
#[cfg(feature = "std")] mod read;
11+
mod read;
1212
mod reseeding;
1313

14-
#[cfg(feature = "std")] pub use self::read::{ReadError, ReadRng};
14+
pub use self::read::{ReadError, ReadRng};
15+
#[cfg_attr(doc_cfg, doc(cfg(feature = "std")))]
1516
pub use self::reseeding::ReseedingRng;

src/rngs/adapter/reseeding.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ where
279279
}
280280

281281

282-
#[cfg(all(unix, feature = "std", not(target_os = "emscripten")))]
282+
#[cfg(all(unix, not(target_os = "emscripten")))]
283283
mod fork {
284284
use core::sync::atomic::{AtomicUsize, Ordering};
285285
use std::sync::Once;
@@ -316,7 +316,7 @@ mod fork {
316316
}
317317
}
318318

319-
#[cfg(not(all(unix, feature = "std", not(target_os = "emscripten"))))]
319+
#[cfg(not(all(unix, not(target_os = "emscripten"))))]
320320
mod fork {
321321
pub fn get_fork_counter() -> usize {
322322
0

src/rngs/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@
9696
//! [`rand_xoshiro`]: https://crates.io/crates/rand_xoshiro
9797
//! [`rng` tag]: https://crates.io/keywords/rng
9898
99-
pub mod adapter;
99+
#[cfg_attr(doc_cfg, doc(cfg(feature = "std")))]
100+
#[cfg(feature = "std")] pub mod adapter;
100101

101102
pub mod mock; // Public so we don't export `StepRng` directly, making it a bit
102103
// more clear it is intended for testing.

0 commit comments

Comments
 (0)