Skip to content

Commit c8519c9

Browse files
committed
Rollup merge of #26174 - mcast:trpl-assignment-empty-tuple, r=steveklabnik
Doc patch for #26120. Extra words here, because "value" is repeated. I haven't read about whether/how it should go to stable (sorry), but I think it would help newcomers. Thanks,
2 parents bd7a6ec + aaf1983 commit c8519c9

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/doc/trpl/functions.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,9 @@ an expression, and a `let` can only begin a statement, not an expression.
144144
Note that assigning to an already-bound variable (e.g. `y = 5`) is still an
145145
expression, although its value is not particularly useful. Unlike other
146146
languages where an assignment evaluates to the assigned value (e.g. `5` in the
147-
previous example), in Rust the value of an assignment is an empty tuple `()`:
147+
previous example), in Rust the value of an assignment is an empty tuple `()`
148+
because the assigned value can have [just one owner](ownership.html), and any
149+
other returned value would be too surprising:
148150

149151
```rust
150152
let mut y = 5;

0 commit comments

Comments
 (0)