Skip to content

Commit b0a545a

Browse files
jolivManishearth
authored andcommitted
Add unit type info and update associated link
Fixes rust-lang#25244
1 parent 6bcaaa3 commit b0a545a

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

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)