about summary refs log tree commit diff
path: root/src/libstd/thread
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2017-09-10 14:03:27 +0200
committerGitHub <noreply@github.com>2017-09-10 14:03:27 +0200
commitf76f2c76dc521bf0c2a337321f3d878357d5af7f (patch)
treea5ed281c04bffc503593d7c377152ddf3e9f95a6 /src/libstd/thread
parent06f39fa10e709bb8512fc912f2371d84203bddc4 (diff)
parentddb072b8d77dbb4708ffa89b361375d761debc9f (diff)
downloadrust-f76f2c76dc521bf0c2a337321f3d878357d5af7f.tar.gz
rust-f76f2c76dc521bf0c2a337321f3d878357d5af7f.zip
Rollup merge of #44396 - joshlf:tls-comment, r=alexcrichton
std::thread::LocalKey: Document limitation with initializers

Document that if a `LocalKey`'s initializer recursively depends on itself, initialization will result in infinite recursion.
Diffstat (limited to 'src/libstd/thread')
-rw-r--r--src/libstd/thread/local.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/libstd/thread/local.rs b/src/libstd/thread/local.rs
index 4ee8132f55c..a53c76a333a 100644
--- a/src/libstd/thread/local.rs
+++ b/src/libstd/thread/local.rs
@@ -31,6 +31,10 @@ use mem;
 /// within a thread, and values that implement [`Drop`] get destructed when a
 /// thread exits. Some caveats apply, which are explained below.
 ///
+/// A `LocalKey`'s initializer cannot recursively depend on itself, and using
+/// a `LocalKey` in this way will cause the initializer to infinitely recurse
+/// on the first call to `with`.
+///
 /// # Examples
 ///
 /// ```