Skip to content

Commit

Permalink
Restrict rand::rngs::adapter to std
Browse files Browse the repository at this point in the history
  • Loading branch information
vks committed Aug 28, 2020
1 parent 2c6c6b1 commit 2ec05bf
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
5 changes: 3 additions & 2 deletions src/rngs/adapter/mod.rs
Expand Up @@ -8,8 +8,9 @@

//! Wrappers / adapters forming RNGs

#[cfg(feature = "std")] mod read;
mod read;
mod reseeding;

#[cfg(feature = "std")] pub use self::read::{ReadError, ReadRng};
pub use self::read::{ReadError, ReadRng};
#[cfg_attr(doc_cfg, doc(cfg(feature = "std")))]
pub use self::reseeding::ReseedingRng;
4 changes: 2 additions & 2 deletions src/rngs/adapter/reseeding.rs
Expand Up @@ -279,7 +279,7 @@ where
}


#[cfg(all(unix, feature = "std", not(target_os = "emscripten")))]
#[cfg(all(unix, not(target_os = "emscripten")))]
mod fork {
use core::sync::atomic::{AtomicUsize, Ordering};
use std::sync::Once;
Expand Down Expand Up @@ -316,7 +316,7 @@ mod fork {
}
}

#[cfg(not(all(unix, feature = "std", not(target_os = "emscripten"))))]
#[cfg(not(all(unix, not(target_os = "emscripten"))))]
mod fork {
pub fn get_fork_counter() -> usize {
0
Expand Down
3 changes: 2 additions & 1 deletion src/rngs/mod.rs
Expand Up @@ -96,7 +96,8 @@
//! [`rand_xoshiro`]: https://crates.io/crates/rand_xoshiro
//! [`rng` tag]: https://crates.io/keywords/rng

pub mod adapter;
#[cfg_attr(doc_cfg, doc(cfg(feature = "std")))]
#[cfg(feature = "std")] pub mod adapter;

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

0 comments on commit 2ec05bf

Please sign in to comment.