Skip to content

Commit f0161e9

Browse files
committed
Add documentation guaranteeing global allocator use of TLS
1 parent 5a022e0 commit f0161e9

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

library/std/src/thread/local.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,13 @@ use crate::fmt;
2424
/// [`with`]) within a thread, and values that implement [`Drop`] get
2525
/// destructed when a thread exits. Some platform-specific caveats apply, which
2626
/// are explained below.
27-
/// Note that, should the destructor panics, the whole process will be [aborted].
27+
/// Note that, should the destructor panic, the whole process will be [aborted].
28+
/// On platforms where initialization requires memory allocation, this is
29+
/// performed directly through [`System`], allowing the [`global allocator`]
30+
/// to make use of thread local storage.
31+
///
32+
/// [`System`]: crate::alloc::System
33+
/// [`global allocator`]: crate::alloc
2834
///
2935
/// A `LocalKey`'s initializer cannot recursively depend on itself. Using a
3036
/// `LocalKey` in this way may cause panics, aborts or infinite recursion on

0 commit comments

Comments
 (0)