Skip to content

Commit 7557b8d

Browse files
committed
./x test tidy --bless fix
1 parent 6f71b2a commit 7557b8d

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

library/std/src/thread/local.rs

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,7 @@ use crate::fmt;
3434
///
3535
/// # Behavior with Foreign Threads
3636
///
37-
/// `LocalKey` exhibits the same foreign thread compatibility as the [`thread_local!`]
38-
/// macro since it uses the same underlying thread-local storage mechanisms.
39-
/// See the [`thread_local!`] documentation for detailed platform-specific behavior.
40-
///
41-
/// ## Example with Foreign Threads
42-
///
43-
/// ```
44-
/// use std::cell::RefCell;
37+
/// `LocalKey` exhibits the same foreign thread compatibility as the [`thread_local!`] macro since it uses the same underlying thread-local storage mechanisms. See the [`thread_local!`] documentation for detailed platform-specific behavior. ## Example with Foreign Threads ``` use std::cell::RefCell;
4538
/// use std::thread::LocalKey;
4639
///
4740
/// static DATA: LocalKey<RefCell<String>> = {
@@ -193,7 +186,7 @@ impl<T: 'static> fmt::Debug for LocalKey<T> {
193186
///
194187
/// Extensive testing reveals compatibility with:
195188
/// - **Native OS threads** (C, C++, Rust)
196-
/// - **M:N schedulers** (Go goroutines via CGO)
189+
/// - **M:N schedulers** (Go goroutines via CGO)
197190
/// - **Green threads** (Ruby MRI via FFI)
198191
/// - **GIL-protected threads** (Python threading module)
199192
///
@@ -203,14 +196,14 @@ impl<T: 'static> fmt::Debug for LocalKey<T> {
203196
/// Uses pthreads TLS (`pthread_setspecific`/`pthread_getspecific`), which works
204197
/// reliably with any runtime that properly initializes pthreads thread-local storage.
205198
///
206-
/// ### Windows Systems
199+
/// ### Windows Systems
207200
/// Compatibility depends on host runtime interaction with Windows TLS slots
208201
/// (`TlsAlloc`/`TlsGetValue`). Behavior may differ from Unix implementations.
209202
///
210203
/// ## Key Guarantees
211204
///
212205
/// - Static initializers run exactly once per thread context
213-
/// - Thread isolation is maintained under high concurrency
206+
/// - Thread isolation is maintained under high concurrency
214207
/// - Thread reuse preserves TLS values correctly
215208
/// - No race conditions observed in tested environments
216209
///
@@ -230,7 +223,7 @@ impl<T: 'static> fmt::Debug for LocalKey<T> {
230223
/// }
231224
///
232225
/// // Safe to call from foreign threads (C, Go, Python, Ruby, etc.)
233-
/// #[unsafe(no_mangle)]
226+
/// #[unsafe(no_mangle)]
234227
/// pub extern "C" fn foreign_callable_function() {
235228
/// DATA.with(|data| {
236229
/// // Thread-safe access across common runtimes
@@ -240,7 +233,7 @@ impl<T: 'static> fmt::Debug for LocalKey<T> {
240233
///
241234
/// For maximum portability to unknown runtimes, consider alternative synchronization
242235
/// patterns. However, for common environments using native threads or proper FFI,
243-
/// `thread_local!` is generally safe.
236+
/// `thread_local!` is generally safe.
244237
///
245238
/// This macro supports a special `const {}` syntax that can be used
246239
/// when the initialization expression can be evaluated as a constant.

0 commit comments

Comments
 (0)