summaryrefslogtreecommitdiffstats
path: root/src/test/ui/for-loop-while/break-while-condition.stderr
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/for-loop-while/break-while-condition.stderr')
-rw-r--r--src/test/ui/for-loop-while/break-while-condition.stderr8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/test/ui/for-loop-while/break-while-condition.stderr b/src/test/ui/for-loop-while/break-while-condition.stderr
index 6960c4fd8..e79f6a75f 100644
--- a/src/test/ui/for-loop-while/break-while-condition.stderr
+++ b/src/test/ui/for-loop-while/break-while-condition.stderr
@@ -31,6 +31,14 @@ LL | | }
|
= note: expected type `!`
found unit type `()`
+note: the function expects a value to always be returned, but loops might run zero times
+ --> $DIR/break-while-condition.rs:24:13
+ |
+LL | while false {
+ | ^^^^^^^^^^^ this might have zero elements to iterate on
+LL | return
+ | ------ if the loop doesn't execute, this value would never get returned
+ = help: return a value for the case when the loop has zero elements to iterate on, or consider changing the return type to account for that possibility
error: aborting due to 3 previous errors