Skip to content

Commit d9bd4d5

Browse files
committed
Add docs for "!" empty Never type (rfc 1216)
1 parent 4901896 commit d9bd4d5

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/doc/book/syntax-index.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@
6161
* `-` (`- expr`): arithmetic negation. Overloadable (`Neg`).
6262
* `-=` (`var -= expr`): arithmetic subtraction & assignment. Overloadable (`SubAssign`).
6363
* `->` (`fn(…) -> type`, `|…| -> type`): function and closure return type. See [Functions], [Closures].
64-
* `-> !` (`fn(…) -> !`, `|…| -> !`): diverging function or closure. See [Diverging Functions].
6564
* `.` (`expr.ident`): member access. See [Structs], [Method Syntax].
6665
* `..` (`..`, `expr..`, `..expr`, `expr..expr`): right-exclusive range literal.
6766
* `..` (`..expr`): struct literal update syntax. See [Structs (Update syntax)].
@@ -159,6 +158,10 @@
159158
* `/*!…*/`: inner block doc comment. See [Comments].
160159
* `/**…*/`: outer block doc comment. See [Comments].
161160

161+
<!-- Special types -->
162+
163+
* `!`: always empty Never type. See [Diverging Functions].
164+
162165
<!-- Various things involving parens and tuples -->
163166

164167
* `()`: empty tuple (*a.k.a.* unit), both literal and type.

src/doc/grammar.md

+7
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,13 @@ bound-list := bound | bound '+' bound-list
764764
bound := path | lifetime
765765
```
766766

767+
### Never type
768+
An empty type
769+
770+
```antlr
771+
never_type : "!" ;
772+
```
773+
767774
### Object types
768775

769776
**FIXME:** grammar?

0 commit comments

Comments
 (0)