From b51d75e3a933cdce36627a0b531acb9521bef510 Mon Sep 17 00:00:00 2001 From: Sylvester Kpei Date: Fri, 3 Jul 2026 20:01:47 -0700 Subject: [PATCH] Clarify that LocalKey::try_with may return AccessError The docs stated that try_with will return an AccessError when the key has been destroyed. This is not guaranteed: on some platforms, TLS slots can be re-initialized during destruction, so the destroyed state cannot always be observed. Change 'will' to 'may' to accurately reflect the best-effort nature of the check. --- library/std/src/thread/local.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/std/src/thread/local.rs b/library/std/src/thread/local.rs index ec0ba9970e4..8684bfab9da 100644 --- a/library/std/src/thread/local.rs +++ b/library/std/src/thread/local.rs @@ -434,7 +434,7 @@ impl LocalKey { /// /// This will lazily initialize the value if this thread has not referenced /// this key yet. If the key has been destroyed (which may happen if this is called - /// in a destructor), this function will return an [`AccessError`]. + /// in a destructor), this function may return an [`AccessError`]. /// /// # Panics ///