Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restrict rand::rngs::adapter to std #1027

Merged
merged 1 commit into from
Aug 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/rngs/adapter/mod.rs
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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