diff options
| author | bors <bors@rust-lang.org> | 2015-06-16 17:08:36 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2015-06-16 17:08:36 +0000 |
| commit | 10356458a7299066b20c4282368af2f76a17ea52 (patch) | |
| tree | 4ecbf0db1c0c4e9f8a9c3b84b7c99ef1595d055d /src/doc/reference.md | |
| parent | 520a471bc5da4ef30f60c0494c6889fe22bbbe2c (diff) | |
| parent | b87056fa31b4c5926c2a0ad78613cf6387f8fdba (diff) | |
| download | rust-10356458a7299066b20c4282368af2f76a17ea52.tar.gz rust-10356458a7299066b20c4282368af2f76a17ea52.zip | |
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!
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 02226353585..5be61a51bf0 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 @@ -2873,7 +2873,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 @@ -3315,6 +3315,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: |
