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.
This commit is contained in:
Marcelo Diop-Gonzalez 2021-10-08 15:29:04 -04:00
parent 87df4dd70f
commit 82c974dab5

View File

@ -412,9 +412,9 @@ pub fn spawn<F, T>(self, f: F) -> io::Result<JoinHandle<T>>
///
/// # 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