Skip to content

Commit

Permalink
Move mod lazy to the top of lib.rs
Browse files Browse the repository at this point in the history
Signed-off-by: Joe Richey <[email protected]>
  • Loading branch information
josephlr committed Jun 10, 2024
1 parent 180358e commit 6e9520f
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,15 @@ use crate::util::{slice_as_uninit_mut, slice_assume_init_mut};
use core::mem::MaybeUninit;

mod error;
// Conditionally import lazy, as not all targets support atomics.
#[cfg(any(
target_os = "android",
target_os = "linux",
target_os = "netbsd",
target_arch = "x86_64",
target_arch = "x86"
))]
mod lazy;
mod util;
// To prevent a breaking change when targets are added, we always export the
// register_custom_getrandom macro, so old Custom RNG crates continue to build.
Expand Down Expand Up @@ -298,7 +307,6 @@ cfg_if! {
))] {
mod util_libc;
mod use_file;
mod lazy;
mod linux_android;
#[path = "linux_android_with_fallback.rs"] mod imp;
} else if #[cfg(any(target_os = "android", target_os = "linux"))] {
Expand All @@ -309,7 +317,6 @@ cfg_if! {
#[path = "solaris.rs"] mod imp;
} else if #[cfg(target_os = "netbsd")] {
mod util_libc;
mod lazy;
#[path = "netbsd.rs"] mod imp;
} else if #[cfg(target_os = "fuchsia")] {
#[path = "fuchsia.rs"] mod imp;
Expand All @@ -331,11 +338,9 @@ cfg_if! {
} else if #[cfg(windows)] {
#[path = "windows.rs"] mod imp;
} else if #[cfg(all(target_arch = "x86_64", target_env = "sgx"))] {
mod lazy;
#[path = "rdrand.rs"] mod imp;
} else if #[cfg(all(feature = "rdrand",
any(target_arch = "x86_64", target_arch = "x86")))] {
mod lazy;
#[path = "rdrand.rs"] mod imp;
} else if #[cfg(all(feature = "js",
any(target_arch = "wasm32", target_arch = "wasm64"),
Expand Down

0 comments on commit 6e9520f

Please sign in to comment.