From a50fe312dc9fec9f9fc3576bc244ef2517ac8f4a Mon Sep 17 00:00:00 2001 From: Stjepan Glavina Date: Tue, 17 Oct 2017 11:02:25 +0200 Subject: [PATCH] Docs: a LocalKey might start in the Valid state --- src/libstd/thread/local.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/libstd/thread/local.rs b/src/libstd/thread/local.rs index a53c76a333a..cb18eed8ee5 100644 --- a/src/libstd/thread/local.rs +++ b/src/libstd/thread/local.rs @@ -325,7 +325,10 @@ impl LocalKey { /// /// Once the initialization expression succeeds, the key transitions to the /// `Valid` state which will guarantee that future calls to [`with`] will - /// succeed within the thread. + /// succeed within the thread. Some keys might skip the `Uninitialized` + /// state altogether and start in the `Valid` state as an optimization + /// (e.g. keys initialized with a constant expression), but no guarantees + /// are made. /// /// When a thread exits, each key will be destroyed in turn, and as keys are /// destroyed they will enter the `Destroyed` state just before the