diff options
| author | joliv <joliv@users.noreply.github.com> | 2015-06-15 23:04:55 -0400 |
|---|---|---|
| committer | joliv <joliv@users.noreply.github.com> | 2015-06-15 23:04:55 -0400 |
| commit | b87056fa31b4c5926c2a0ad78613cf6387f8fdba (patch) | |
| tree | 56c06a591a9549d3e56abc5de032b37ffc55291f /src/doc/reference.md | |
| parent | 906ad724620e1ff93082b364a38761940a7abdcf (diff) | |
| download | rust-b87056fa31b4c5926c2a0ad78613cf6387f8fdba.tar.gz rust-b87056fa31b4c5926c2a0ad78613cf6387f8fdba.zip | |
Add unit type info and update associated link
Fixes #25244
Diffstat (limited to 'src/doc/reference.md')
| -rw-r--r-- | src/doc/reference.md | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/doc/reference.md b/src/doc/reference.md index c19aec78de2..9bf595fb436 100644 --- a/src/doc/reference.md +++ b/src/doc/reference.md @@ -638,7 +638,7 @@ apply to the crate as a whole. ``` A crate that contains a `main` function can be compiled to an executable. If a -`main` function is present, its return type must be [`unit`](#primitive-types) +`main` function is present, its return type must be [`unit`](#tuple-types) and it must take no arguments. # Items and attributes @@ -2874,7 +2874,7 @@ The `+`, `-`, `*`, `/`, `%`, `&`, `|`, `^`, `<<`, and `>>` operators may be composed with the `=` operator. The expression `lval OP= val` is equivalent to `lval = lval OP val`. For example, `x = x + 1` may be written as `x += 1`. -Any such expression always has the [`unit`](#primitive-types) type. +Any such expression always has the [`unit`](#tuple-types) type. #### Operator precedence @@ -3316,6 +3316,9 @@ assert!(b != "world"); assert!(p.0 == 10); ``` +For historical reasons and convenience, the tuple type with no elements (`()`) +is often called ‘unit’ or ‘the unit type’. + ### Array, and Slice types Rust has two different types for a list of items: |
