Skip to content

Commit ddb072b

Browse files
committed
std::thread::LocalKey: Document limitation with initializers
1 parent d93036a commit ddb072b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Diff for: src/libstd/thread/local.rs

+4
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ use mem;
3131
/// within a thread, and values that implement [`Drop`] get destructed when a
3232
/// thread exits. Some caveats apply, which are explained below.
3333
///
34+
/// A `LocalKey`'s initializer cannot recursively depend on itself, and using
35+
/// a `LocalKey` in this way will cause the initializer to infinitely recurse
36+
/// on the first call to `with`.
37+
///
3438
/// # Examples
3539
///
3640
/// ```

0 commit comments

Comments
 (0)