Skip to content

Commit 8faaeca

Browse files
Rollup merge of rust-lang#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.
2 parents 5933e5c + c4dc39b commit 8faaeca

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

library/std/src/thread/mod.rs

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

library/std/src/thread/scoped.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,9 +181,8 @@ impl<'scope, 'env> Scope<'scope, 'env> {
181181
/// end of the scope. In that case, if the spawned thread panics, [`scope`] will
182182
/// panic after all threads are joined.
183183
///
184-
/// This call will create a thread using default parameters of [`Builder`].
185-
/// If you want to specify the stack size or the name of the thread, use
186-
/// [`Builder::spawn_scoped`] instead.
184+
/// This function creates a thread with the default parameters of [`Builder`].
185+
/// To specify the new thread's stack size or the name, use [`Builder::spawn_scoped`].
187186
///
188187
/// # Panics
189188
///

0 commit comments

Comments
 (0)