Rollup merge of #147494 - evanj:evan.jones/thread-spawn-link, r=joboet

std::thread spawn: Docs: Link to Builder::spawn; Make same.

Replace "use this API instead" with a link to Builder::spawn. Edit the paragraph to make it slightly clearer.

The Scope::spawn method already included a link to `Builder::spawn_scoped`. Make the docs for `Scope::spawn` and `thread::spawn` nearly the same.
This commit is contained in:
Matthias Krüger 2025-10-18 15:09:03 +02:00 committed by GitHub
commit 55a3df8cee
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 6 deletions

View file

@ -620,9 +620,8 @@ impl Builder {
/// (It is the responsibility of the program to either eventually join threads it
/// creates or detach them; otherwise, a resource leak will result.)
///
/// This call will create a thread using default parameters of [`Builder`], if you
/// want to specify the stack size or the name of the thread, use this API
/// instead.
/// This function creates a thread with the default parameters of [`Builder`].
/// To specify the new thread's stack size or the name, use [`Builder::spawn`].
///
/// As you can see in the signature of `spawn` there are two constraints on
/// both the closure given to `spawn` and its return value, let's explain them:

View file

@ -181,9 +181,8 @@ impl<'scope, 'env> Scope<'scope, 'env> {
/// end of the scope. In that case, if the spawned thread panics, [`scope`] will
/// panic after all threads are joined.
///
/// This call will create a thread using default parameters of [`Builder`].
/// If you want to specify the stack size or the name of the thread, use
/// [`Builder::spawn_scoped`] instead.
/// This function creates a thread with the default parameters of [`Builder`].
/// To specify the new thread's stack size or the name, use [`Builder::spawn_scoped`].
///
/// # Panics
///