|
36 | 36 |
|
37 | 37 | use std::collections::HashMap;
|
38 | 38 | use std::hash::{BuildHasher, Hash};
|
| 39 | +pub use std::sync::OnceLock; |
39 | 40 |
|
40 |
| -pub use crate::marker::*; |
| 41 | +pub use parking_lot::{ |
| 42 | + MappedRwLockReadGuard as MappedReadGuard, MappedRwLockWriteGuard as MappedWriteGuard, |
| 43 | + RwLockReadGuard as ReadGuard, RwLockWriteGuard as WriteGuard, |
| 44 | +}; |
41 | 45 |
|
42 |
| -mod lock; |
| 46 | +pub use self::atomic::AtomicU64; |
| 47 | +pub use self::freeze::{FreezeLock, FreezeReadGuard, FreezeWriteGuard}; |
43 | 48 | #[doc(no_inline)]
|
44 |
| -pub use lock::{Lock, LockGuard, Mode}; |
45 |
| - |
46 |
| -mod worker_local; |
47 |
| -pub use worker_local::{Registry, WorkerLocal}; |
| 49 | +pub use self::lock::{Lock, LockGuard, Mode}; |
| 50 | +pub use self::mode::{is_dyn_thread_safe, set_dyn_thread_safe_mode}; |
| 51 | +pub use self::parallel::{ |
| 52 | + join, par_for_each_in, par_map, parallel_guard, scope, try_par_for_each_in, |
| 53 | +}; |
| 54 | +pub use self::vec::{AppendOnlyIndexVec, AppendOnlyVec}; |
| 55 | +pub use self::worker_local::{Registry, WorkerLocal}; |
| 56 | +pub use crate::marker::*; |
48 | 57 |
|
| 58 | +mod freeze; |
| 59 | +mod lock; |
49 | 60 | mod parallel;
|
50 |
| -pub use parallel::{join, par_for_each_in, par_map, parallel_guard, scope, try_par_for_each_in}; |
51 |
| -pub use vec::{AppendOnlyIndexVec, AppendOnlyVec}; |
52 |
| - |
53 | 61 | mod vec;
|
| 62 | +mod worker_local; |
54 | 63 |
|
55 |
| -mod freeze; |
56 |
| -pub use freeze::{FreezeLock, FreezeReadGuard, FreezeWriteGuard}; |
| 64 | +/// Keep the conditional imports together in a submodule, so that import-sorting |
| 65 | +/// doesn't split them up. |
| 66 | +mod atomic { |
| 67 | + // Most hosts can just use a regular AtomicU64. |
| 68 | + #[cfg(target_has_atomic = "64")] |
| 69 | + pub use std::sync::atomic::AtomicU64; |
| 70 | + |
| 71 | + // Some 32-bit hosts don't have AtomicU64, so use a fallback. |
| 72 | + #[cfg(not(target_has_atomic = "64"))] |
| 73 | + pub use portable_atomic::AtomicU64; |
| 74 | +} |
57 | 75 |
|
58 | 76 | mod mode {
|
59 | 77 | use std::sync::atomic::{AtomicU8, Ordering};
|
@@ -97,18 +115,6 @@ mod mode {
|
97 | 115 |
|
98 | 116 | // FIXME(parallel_compiler): Get rid of these aliases across the compiler.
|
99 | 117 |
|
100 |
| -// Use portable AtomicU64 for targets without native 64-bit atomics |
101 |
| -#[cfg(target_has_atomic = "64")] |
102 |
| -pub use std::sync::atomic::AtomicU64; |
103 |
| - |
104 |
| -pub use mode::{is_dyn_thread_safe, set_dyn_thread_safe_mode}; |
105 |
| -pub use parking_lot::{ |
106 |
| - MappedRwLockReadGuard as MappedReadGuard, MappedRwLockWriteGuard as MappedWriteGuard, |
107 |
| - RwLockReadGuard as ReadGuard, RwLockWriteGuard as WriteGuard, |
108 |
| -}; |
109 |
| -#[cfg(not(target_has_atomic = "64"))] |
110 |
| -pub use portable_atomic::AtomicU64; |
111 |
| - |
112 | 118 | pub type LRef<'a, T> = &'a T;
|
113 | 119 |
|
114 | 120 | #[derive(Debug, Default)]
|
|
0 commit comments