Skip to content

Commit 1035645

Browse files
committed
Auto merge of #24738 - joliv:patch-2, r=steveklabnik
The "unit value" is a value of the "unit type," not the "unit value type." Regardless of correctness, this straight syntax is easier to grok. Part of #16676 Sorry if something's off here, it's my first pull request to rust!
2 parents 520a471 + b87056f commit 1035645

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/doc/reference.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,7 @@ apply to the crate as a whole.
638638
```
639639

640640
A crate that contains a `main` function can be compiled to an executable. If a
641-
`main` function is present, its return type must be [`unit`](#primitive-types)
641+
`main` function is present, its return type must be [`unit`](#tuple-types)
642642
and it must take no arguments.
643643

644644
# Items and attributes
@@ -2873,7 +2873,7 @@ The `+`, `-`, `*`, `/`, `%`, `&`, `|`, `^`, `<<`, and `>>` operators may be
28732873
composed with the `=` operator. The expression `lval OP= val` is equivalent to
28742874
`lval = lval OP val`. For example, `x = x + 1` may be written as `x += 1`.
28752875

2876-
Any such expression always has the [`unit`](#primitive-types) type.
2876+
Any such expression always has the [`unit`](#tuple-types) type.
28772877

28782878
#### Operator precedence
28792879

@@ -3315,6 +3315,9 @@ assert!(b != "world");
33153315
assert!(p.0 == 10);
33163316
```
33173317

3318+
For historical reasons and convenience, the tuple type with no elements (`()`)
3319+
is often called ‘unit’ or ‘the unit type’.
3320+
33183321
### Array, and Slice types
33193322

33203323
Rust has two different types for a list of items:

0 commit comments

Comments
 (0)