Skip to content

Commit 6a92cf9

Browse files
committed
Add note about expression vs. statement to dining philosphers problem,
to address #25488 .
1 parent 78c4d53 commit 6a92cf9

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/doc/trpl/dining-philosophers.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,9 @@ an extra annotation, `move`, to indicate that the closure is going to take
432432
ownership of the values it’s capturing. Primarily, the `p` variable of the
433433
`map` function.
434434

435-
Inside the thread, all we do is call `eat()` on `p`.
435+
Inside the thread, all we do is call `eat()` on `p`. Also note that the call to `thread::spawn` lacks a trailing semicolon, making this an expression. This distinction is important, yielding the correct return value. For more details, read [Expressions vs. Statements][es].
436+
437+
[es]: functions.html#expressions-vs.-statements
436438

437439
```rust,ignore
438440
}).collect();

0 commit comments

Comments
 (0)