Skip to content

Commit 6e9520f

Browse files
committed
Move mod lazy to the top of lib.rs
Signed-off-by: Joe Richey <joerichey@google.com>
1 parent 180358e commit 6e9520f

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

src/lib.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,15 @@ use crate::util::{slice_as_uninit_mut, slice_assume_init_mut};
216216
use core::mem::MaybeUninit;
217217

218218
mod error;
219+
// Conditionally import lazy, as not all targets support atomics.
220+
#[cfg(any(
221+
target_os = "android",
222+
target_os = "linux",
223+
target_os = "netbsd",
224+
target_arch = "x86_64",
225+
target_arch = "x86"
226+
))]
227+
mod lazy;
219228
mod util;
220229
// To prevent a breaking change when targets are added, we always export the
221230
// register_custom_getrandom macro, so old Custom RNG crates continue to build.
@@ -298,7 +307,6 @@ cfg_if! {
298307
))] {
299308
mod util_libc;
300309
mod use_file;
301-
mod lazy;
302310
mod linux_android;
303311
#[path = "linux_android_with_fallback.rs"] mod imp;
304312
} else if #[cfg(any(target_os = "android", target_os = "linux"))] {
@@ -309,7 +317,6 @@ cfg_if! {
309317
#[path = "solaris.rs"] mod imp;
310318
} else if #[cfg(target_os = "netbsd")] {
311319
mod util_libc;
312-
mod lazy;
313320
#[path = "netbsd.rs"] mod imp;
314321
} else if #[cfg(target_os = "fuchsia")] {
315322
#[path = "fuchsia.rs"] mod imp;
@@ -331,11 +338,9 @@ cfg_if! {
331338
} else if #[cfg(windows)] {
332339
#[path = "windows.rs"] mod imp;
333340
} else if #[cfg(all(target_arch = "x86_64", target_env = "sgx"))] {
334-
mod lazy;
335341
#[path = "rdrand.rs"] mod imp;
336342
} else if #[cfg(all(feature = "rdrand",
337343
any(target_arch = "x86_64", target_arch = "x86")))] {
338-
mod lazy;
339344
#[path = "rdrand.rs"] mod imp;
340345
} else if #[cfg(all(feature = "js",
341346
any(target_arch = "wasm32", target_arch = "wasm64"),

0 commit comments

Comments
 (0)