Skip to content

Commit 8a02263

Browse files
authored
Merge pull request rust-lang#54 from Havvy/loop-divergence
Add diverging loops to diverging function section.
2 parents f7a108d + 3ee6ce3 commit 8a02263

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/items.md

+4-3
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)