|
150 | 150 |
|
151 | 151 | #![stable(feature = "rust1", since = "1.0.0")]
|
152 | 152 | #![deny(unsafe_op_in_unsafe_fn)]
|
| 153 | +// Under `test`, `__FastLocalKeyInner` seems unused. |
| 154 | +#![cfg_attr(test, allow(dead_code))] |
153 | 155 |
|
154 | 156 | #[cfg(all(test, not(target_os = "emscripten")))]
|
155 | 157 | mod tests;
|
@@ -192,32 +194,40 @@ pub use scoped::{scope, Scope, ScopedJoinHandle};
|
192 | 194 | #[stable(feature = "rust1", since = "1.0.0")]
|
193 | 195 | pub use self::local::{AccessError, LocalKey};
|
194 | 196 |
|
195 |
| -// Select the type used by the thread_local! macro to access TLS keys. There |
196 |
| -// are three types: "static", "fast", "OS". The "OS" thread local key |
| 197 | +// Provide the type used by the thread_local! macro to access TLS keys. This |
| 198 | +// needs to be kept in sync with the macro itself (in `local.rs`). |
| 199 | +// There are three types: "static", "fast", "OS". The "OS" thread local key |
197 | 200 | // type is accessed via platform-specific API calls and is slow, while the "fast"
|
198 | 201 | // key type is accessed via code generated via LLVM, where TLS keys are set up
|
199 | 202 | // by the elf linker. "static" is for single-threaded platforms where a global
|
200 | 203 | // static is sufficient.
|
201 | 204 |
|
202 | 205 | #[unstable(feature = "libstd_thread_internals", issue = "none")]
|
203 |
| -#[cfg(target_thread_local)] |
204 | 206 | #[cfg(not(test))]
|
| 207 | +#[cfg(all( |
| 208 | + target_thread_local, |
| 209 | + not(all(target_family = "wasm", not(target_feature = "atomics"))), |
| 210 | +))] |
205 | 211 | #[doc(hidden)]
|
206 | 212 | pub use self::local::fast::Key as __FastLocalKeyInner;
|
207 |
| -#[unstable(feature = "libstd_thread_internals", issue = "none")] |
208 |
| -#[cfg(target_thread_local)] |
209 |
| -#[cfg(test)] // when building for tests, use real std's key |
210 |
| -pub use realstd::thread::__FastLocalKeyInner; |
211 | 213 |
|
| 214 | +// when building for tests, use real std's type |
212 | 215 | #[unstable(feature = "libstd_thread_internals", issue = "none")]
|
213 |
| -#[cfg(target_thread_local)] |
214 | 216 | #[cfg(test)]
|
215 |
| -pub use self::local::fast::Key as __FastLocalKeyInnerUnused; // we import this anyway to silence 'unused' warnings |
| 217 | +#[cfg(all( |
| 218 | + target_thread_local, |
| 219 | + not(all(target_family = "wasm", not(target_feature = "atomics"))), |
| 220 | +))] |
| 221 | +pub use realstd::thread::__FastLocalKeyInner; |
216 | 222 |
|
217 | 223 | #[unstable(feature = "libstd_thread_internals", issue = "none")]
|
| 224 | +#[cfg(all( |
| 225 | + not(target_thread_local), |
| 226 | + not(all(target_family = "wasm", not(target_feature = "atomics"))), |
| 227 | +))] |
218 | 228 | #[doc(hidden)]
|
219 |
| -#[cfg(not(target_thread_local))] |
220 | 229 | pub use self::local::os::Key as __OsLocalKeyInner;
|
| 230 | + |
221 | 231 | #[unstable(feature = "libstd_thread_internals", issue = "none")]
|
222 | 232 | #[cfg(all(target_family = "wasm", not(target_feature = "atomics")))]
|
223 | 233 | #[doc(hidden)]
|
|
0 commit comments