Skip to content

Commit 1d9be09

Browse files
committed
add docs for never type
1 parent a8755cc commit 1d9be09

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/types.md

+9
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ types:
1717
* The [machine types] (integer and floating-point).
1818
* The [machine-dependent integer types].
1919
* The [textual types] `char` and `str`.
20+
* The [never type] `!`
2021

2122
There are also some primitive constructs for generic types built in to the
2223
language:
@@ -31,6 +32,7 @@ language:
3132
[machine types]: #machine-types
3233
[machine-dependent integer types]: #machine-dependent-integer-types
3334
[textual types]: #textual-types
35+
[never-type]: #never-type
3436
[Tuples]: #tuple-types
3537
[Arrays]: #array-and-slice-types
3638
[Slices]: #array-and-slice-types
@@ -84,6 +86,13 @@ unsigned bytes holding a sequence of UTF-8 code points. Since `str` is a
8486
[dynamically sized type], it is not a _first-class_ type, but can only be
8587
instantiated through a pointer type, such as `&str`.
8688

89+
## Never type
90+
91+
The never type `!` is a type with no values, representing the result of
92+
computations that never complete. Although it has size `0` the empty bit
93+
pattern is not a valid representation. Expressions of type `!` can be coerced
94+
into any other type.
95+
8796
## Tuple types
8897

8998
A tuple *type* is a heterogeneous product of other types, called the *elements*

0 commit comments

Comments
 (0)