Skip to content

Commit c5d2a89

Browse files
committed
LocalKey<T>: document that the dtor cannot unwind
1 parent 1f76d21 commit c5d2a89

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Diff for: library/std/src/thread/local.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,17 @@ use crate::fmt;
2222
///
2323
/// Initialization is dynamically performed on the first call to a setter (e.g.
2424
/// [`with`]) within a thread, and values that implement [`Drop`] get
25-
/// destructed when a thread exits. Some caveats apply, which are explained below.
25+
/// destructed when a thread exits. Some platform-specific caveats apply, which
26+
/// are explained below.
27+
/// Note that, should the destructor panics, the whole process will be [aborted],
28+
/// as the TLS destructor cannot unwind.
2629
///
2730
/// A `LocalKey`'s initializer cannot recursively depend on itself. Using a
2831
/// `LocalKey` in this way may cause panics, aborts or infinite recursion on
2932
/// the first call to `with`.
3033
///
34+
/// [abort]: crate::process::abort
35+
///
3136
/// # Single-thread Synchronization
3237
///
3338
/// Though there is no potential race with other threads, it is still possible to

0 commit comments

Comments
 (0)