diff options
| author | kennytm <kennytm@gmail.com> | 2017-10-19 01:59:53 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-10-19 01:59:53 +0800 |
| commit | c6892f470eb2ae1c6bc13c1568bacb2b0b992823 (patch) | |
| tree | 3626db14a757e0dfba36350e37bc884c097ca749 /src/libstd/thread | |
| parent | c77068a94b385201f8f121b5c7edb7bb2827f553 (diff) | |
| parent | a50fe312dc9fec9f9fc3576bc244ef2517ac8f4a (diff) | |
| download | rust-c6892f470eb2ae1c6bc13c1568bacb2b0b992823.tar.gz rust-c6892f470eb2ae1c6bc13c1568bacb2b0b992823.zip | |
Rollup merge of #45340 - stjepang:localkey-state-doc-skip-uninitialized, r=alexcrichton
Docs: a LocalKey might start in the Valid state Add a comment to the docs for `LocalKey::state` explaining that some keys might skip the `Uninitialized` state and start in the `Valid` state. cc #27716 r? @alexcrichton
Diffstat (limited to 'src/libstd/thread')
| -rw-r--r-- | src/libstd/thread/local.rs | 5 |
1 files changed, 4 insertions, 1 deletions
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<T: 'static> LocalKey<T> { /// /// 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 |
