Skip to content

Commit

Permalink
Mount the lazy module only when neccecary (#509)
Browse files Browse the repository at this point in the history
  • Loading branch information
newpavlov authored Oct 9, 2024
1 parent 387248f commit 74e2391
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 0 additions & 2 deletions src/lazy.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
//! Helpers built around pointer-sized atomics.
#![cfg(target_has_atomic = "ptr")]
#![allow(dead_code)]
use core::sync::atomic::{AtomicUsize, Ordering};

// This structure represents a lazily initialized static usize value. Useful
Expand Down
5 changes: 4 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,6 @@ extern crate cfg_if;
use core::mem::MaybeUninit;

mod error;
mod lazy;
mod util;

#[cfg(feature = "std")]
Expand All @@ -275,6 +274,8 @@ cfg_if! {
} else if #[cfg(getrandom_backend = "rdrand")] {
#[cfg(not(any(target_arch = "x86_64", target_arch = "x86")))]
compile_error!("`rdrand` backend can be enabled only for x86 and x86-64 targets!");

mod lazy;
#[path = "rdrand.rs"] mod imp;
} else if #[cfg(getrandom_backend = "wasm_js")] {
#[cfg(not(all(
Expand Down Expand Up @@ -351,6 +352,7 @@ cfg_if! {
),
)
))] {
mod lazy;
mod util_libc;
mod use_file;
mod linux_android;
Expand Down Expand Up @@ -387,6 +389,7 @@ 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(
any(target_arch = "wasm32", target_arch = "wasm64"),
Expand Down

0 comments on commit 74e2391

Please sign in to comment.