summaryrefslogtreecommitdiffstats
path: root/src/test/ui/typeck/issue-98982.stderr
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:03:36 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:03:36 +0000
commit17d40c6057c88f4c432b0d7bac88e1b84cb7e67f (patch)
tree3f66c4a5918660bb8a758ab6cda5ff8ee4f6cdcd /src/test/ui/typeck/issue-98982.stderr
parentAdding upstream version 1.64.0+dfsg1. (diff)
downloadrustc-f7f0cc2a5d72e2c61c1f6900e70eec992bea4273.tar.xz
rustc-f7f0cc2a5d72e2c61c1f6900e70eec992bea4273.zip
Adding upstream version 1.65.0+dfsg1.upstream/1.65.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/ui/typeck/issue-98982.stderr')
-rw-r--r--src/test/ui/typeck/issue-98982.stderr24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/test/ui/typeck/issue-98982.stderr b/src/test/ui/typeck/issue-98982.stderr
new file mode 100644
index 000000000..3c9806ac9
--- /dev/null
+++ b/src/test/ui/typeck/issue-98982.stderr
@@ -0,0 +1,24 @@
+error[E0308]: mismatched types
+ --> $DIR/issue-98982.rs:2:5
+ |
+LL | fn foo() -> i32 {
+ | --- expected `i32` because of return type
+LL | / for i in 0..0 {
+LL | |
+LL | | return i;
+LL | | }
+ | |_____^ expected `i32`, found `()`
+ |
+note: the function expects a value to always be returned, but loops might run zero times
+ --> $DIR/issue-98982.rs:2:5
+ |
+LL | for i in 0..0 {
+ | ^^^^^^^^^^^^^ this might have zero elements to iterate on
+LL |
+LL | return i;
+ | -------- 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 previous error
+
+For more information about this error, try `rustc --explain E0308`.