@@ -192,14 +192,12 @@ pub use scoped::{scope, Scope, ScopedJoinHandle};
192
192
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
193
193
pub use self :: local:: { AccessError , LocalKey } ;
194
194
195
- // The types used by the thread_local! macro to access TLS keys. Note that there
196
- // are two types, the "OS" type and the "fast" type . The OS thread local key
197
- // type is accessed via platform-specific API calls and is slow, while the fast
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
+ // type is accessed via platform-specific API calls and is slow, while the " fast"
198
198
// key type is accessed via code generated via LLVM, where TLS keys are set up
199
- // by the elf linker. Note that the OS TLS type is always available: on macOS
200
- // the standard library is compiled with support for older platform versions
201
- // where fast TLS was not available; end-user code is compiled with fast TLS
202
- // where available, but both are needed.
199
+ // by the elf linker. "static" is for single-threaded platforms where a global
200
+ // static is sufficient.
203
201
204
202
#[ unstable( feature = "libstd_thread_internals" , issue = "none" ) ]
205
203
#[ cfg( target_thread_local) ]
@@ -210,13 +208,15 @@ pub use self::local::fast::Key as __FastLocalKeyInner;
210
208
#[ cfg( target_thread_local) ]
211
209
#[ cfg( test) ] // when building for tests, use real std's key
212
210
pub use realstd:: thread:: __FastLocalKeyInner;
211
+
213
212
#[ unstable( feature = "libstd_thread_internals" , issue = "none" ) ]
214
213
#[ cfg( target_thread_local) ]
215
214
#[ cfg( test) ]
216
215
pub use self :: local:: fast:: Key as __FastLocalKeyInnerUnused; // we import this anyway to silence 'unused' warnings
217
216
218
217
#[ unstable( feature = "libstd_thread_internals" , issue = "none" ) ]
219
218
#[ doc( hidden) ]
219
+ #[ cfg( not( target_thread_local) ) ]
220
220
pub use self :: local:: os:: Key as __OsLocalKeyInner;
221
221
#[ unstable( feature = "libstd_thread_internals" , issue = "none" ) ]
222
222
#[ cfg( all( target_family = "wasm" , not( target_feature = "atomics" ) ) ) ]
0 commit comments