Skip to content

Commit 3ee6ce3

Browse files
committed
Add diverging loops to diverging function section.
I went with "associated break" here to match the terminology given by PR #56.
1 parent f7a108d commit 3ee6ce3

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/items.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -365,9 +365,10 @@ fn my_err(s: &str) -> ! {
365365
```
366366

367367
We call such functions "diverging" because they never return a value to the
368-
caller. Every control path in a diverging function must end with a `panic!()` or
369-
a call to another diverging function on every control path. The `!` annotation
370-
does *not* denote a type.
368+
caller. Every control path in a diverging function must end with a `panic!()`,
369+
a loop expression without an associated break expression, or a call to another
370+
diverging function on every control path. The `!` annotation does *not* denote
371+
a type.
371372

372373
It might be necessary to declare a diverging function because as mentioned
373374
previously, the typechecker checks that every control path in a function ends

0 commit comments

Comments
 (0)