Uh oh!
There was an error while loading. Please reload this page.
[Doc] Add 'static and Send constraints explanations to thread::spawn - #41980
Conversation
'static and Send constraints explanations to thread::spawn'static and Send constraints explanations to thread::spawnThere was a problem hiding this comment.
Thread being able to outlive the scope it has been created in (i.e. detaching) is only an explanation for why closure itself is 'static, and not its return value. The return value has the 'static bound because the return value outlives the thread it is returned from; this is true regardless of whether the thread gets detached or not.
There was a problem hiding this comment.
They are actually linked.
The value a thread returns must outlive the closure, but the fact that the thread can detach implies that the closure must be 'static, since the value must live at least as long as the closure it must then also be 'static
r? @rust-lang/docs |
GuillaumeGomez
commented
May 14, 2017
Tidy errors: |
gamazeps
commented
May 14, 2017
Damn, that is valid markdown though... |
Mark-Simulacrum
commented
May 20, 2017
@steveklabnik This looks read for review. |
steveklabnik
commented
May 24, 2017
@bors: r+ rollup thanks! |
bors
commented
May 24, 2017
📌 Commit 770bd57 has been approved by |
[Doc] Add `'static` and `Send` constraints explanations to `thread::spawn` Part of rust-lang#29378. Explains why the constraints on the closure and its return value are `'static` and `Send`. Allows to tick of `thread::spawn` from the list of things to document in the `thread` module. r? @steveklabnik
[Doc] Add `'static` and `Send` constraints explanations to `thread::spawn` Part of rust-lang#29378. Explains why the constraints on the closure and its return value are `'static` and `Send`. Allows to tick of `thread::spawn` from the list of things to document in the `thread` module. r? @steveklabnik
[Doc] Add `'static` and `Send` constraints explanations to `thread::spawn` Part of rust-lang#29378. Explains why the constraints on the closure and its return value are `'static` and `Send`. Allows to tick of `thread::spawn` from the list of things to document in the `thread` module. r? @steveklabnik
[Doc] Add `'static` and `Send` constraints explanations to `thread::spawn` Part of rust-lang#29378. Explains why the constraints on the closure and its return value are `'static` and `Send`. Allows to tick of `thread::spawn` from the list of things to document in the `thread` module. r? @steveklabnik
[Doc] Add `'static` and `Send` constraints explanations to `thread::spawn` Part of rust-lang#29378. Explains why the constraints on the closure and its return value are `'static` and `Send`. Allows to tick of `thread::spawn` from the list of things to document in the `thread` module. r? @steveklabnik
Part of #29378.
Explains why the constraints on the closure and its return value are
'staticandSend.Allows to tick of
thread::spawnfrom the list of things to document in thethreadmodule.r? @steveklabnik