From 82c974dab5cd69862528724a36a954d9699b3d98 Mon Sep 17 00:00:00 2001 From: Marcelo Diop-Gonzalez Date: Fri, 8 Oct 2021 15:29:04 -0400 Subject: [PATCH] Fix minor std::thread documentation typo callers of spawn_unchecked() need to make sure that the thread not outlive references in the passed closure, not the other way around. --- library/std/src/thread/mod.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/library/std/src/thread/mod.rs b/library/std/src/thread/mod.rs index 707a55b6258..7d404aff30e 100644 --- a/library/std/src/thread/mod.rs +++ b/library/std/src/thread/mod.rs @@ -412,9 +412,9 @@ pub fn spawn(self, f: F) -> io::Result> /// /// # Safety /// - /// The caller has to ensure that no references in the supplied thread closure - /// or its return type can outlive the spawned thread's lifetime. This can be - /// guaranteed in two ways: + /// The caller has to ensure that the spawned thread does not outlive any + /// references in the supplied thread closure and its return type. + /// This can be guaranteed in two ways: /// /// - ensure that [`join`][`JoinHandle::join`] is called before any referenced /// data is dropped