Skip to content

Commit

Permalink
Rollup merge of rust-lang#32679 - tclfs:patch-1, r=steveklabnik
Browse files Browse the repository at this point in the history
Remove error description of `move`

(1) `x` can be used in main() after the call to spawn(). Because the variables follow normal move semantics, though the keyword `move` is used, and i32 implements `Copy`.
(2) I remove this sentence because the previous sentence gives the referrence to `move closures`, and more description of `move` may be redundant.
  • Loading branch information
steveklabnik committed Apr 6, 2016
2 parents 9c59d6b + a2f6d29 commit ec3917a
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/doc/book/concurrency.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,7 @@ thread may outlive the scope of `x`, leading to a dangling pointer.

To fix this, we use a `move` closure as mentioned in the error message. `move`
closures are explained in depth [here](closures.html#move-closures); basically
they move variables from their environment into themselves. This means that `x`
is now owned by the closure, and cannot be used in `main()` after the call to
`spawn()`.
they move variables from their environment into themselves.

```rust
use std::thread;
Expand Down

0 comments on commit ec3917a

Please sign in to comment.