Rollup merge of #89678 - marcelo-gonzalez:master, r=joshtriplett

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:
Matthias Krüger 2021-10-09 11:56:01 +02:00 committed by GitHub
commit 346f833c3d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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