Skip to content

Commit b87056f

Browse files
committed
Add unit type info and update associated link
Fixes #25244
1 parent 906ad72 commit b87056f

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
@@ -2874,7 +2874,7 @@ The `+`, `-`, `*`, `/`, `%`, `&`, `|`, `^`, `<<`, and `>>` operators may be
28742874
composed with the `=` operator. The expression `lval OP= val` is equivalent to
28752875
`lval = lval OP val`. For example, `x = x + 1` may be written as `x += 1`.
28762876

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

28792879
#### Operator precedence
28802880

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

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

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

0 commit comments

Comments
 (0)