Skip to content

Commit 881fb77

Browse files
authored
Rollup merge of #110049 - SkiFire13:localkey-with-docs-fix, r=workingjubilee
Don't claim `LocalKey::with` prevents a reference to be sent across threads The documentation for `LocalKey` claims that `with` yields a reference that cannot be sent across threads, but this is false since you can easily do that with scoped threads. What it actually prevents is the reference from outliving the current thread.
2 parents 88eddda + 35633e1 commit 881fb77

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

std/src/thread/local.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ use crate::fmt;
1818
/// target platform. It is instantiated with the [`thread_local!`] macro and the
1919
/// primary method is the [`with`] method.
2020
///
21-
/// The [`with`] method yields a reference to the contained value which cannot be
22-
/// sent across threads or escape the given closure.
21+
/// The [`with`] method yields a reference to the contained value which cannot
22+
/// outlive the current thread or escape the given closure.
2323
///
2424
/// [`thread_local!`]: crate::thread_local
2525
///

0 commit comments

Comments
 (0)