Skip to content

Commit 3db4fbb

Browse files
committed
Add diverging loops to diverging function section.
I went with "corresponding break" here since you could have a break that's inside another loop expression for the inner loop expression, but that wouldn't change the divergence. That probably needs to be better fleshed out, but I'd leave the fleshing out of divergence to the loop item section of the reference.
1 parent f7a108d commit 3db4fbb

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/items.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,8 @@ 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
368+
caller. Every control path in a diverging function must end with a `panic!()`,
369+
a loop expression that does not contain a corresponding break expression, or
369370
a call to another diverging function on every control path. The `!` annotation
370371
does *not* denote a type.
371372

0 commit comments

Comments
 (0)