about summary refs log tree commit diff
path: root/tests/ui/issues
diff options
context:
space:
mode:
authorGurinder Singh <frederick.the.fool@gmail.com>2024-04-19 18:30:28 +0530
committerGurinder Singh <frederick.the.fool@gmail.com>2024-04-30 12:46:59 +0530
commit6289ed842897f75f7b1f06aee44f9f123f57077d (patch)
tree1acd650e8b587e94c67f193ab2a117442373d0a1 /tests/ui/issues
parentf973a15a109cbfced3107d91f0224ff2c8381e74 (diff)
downloadrust-6289ed842897f75f7b1f06aee44f9f123f57077d.tar.gz
rust-6289ed842897f75f7b1f06aee44f9f123f57077d.zip
Remove note about iteration count in coerce
and replace it with a simple note suggesting
returning a value.

The type mismatch error was never due to
how many times the loop iterates. It is more
because of the peculiar structure of what the for
loop desugars to. So the note talking about
iteration count didn't make sense
Diffstat (limited to 'tests/ui/issues')
-rw-r--r--tests/ui/issues/issue-27042.stderr2
-rw-r--r--tests/ui/issues/issue-50585.stderr6
2 files changed, 8 insertions, 0 deletions
diff --git a/tests/ui/issues/issue-27042.stderr b/tests/ui/issues/issue-27042.stderr
index ba39399e46e..6586e61f2f6 100644
--- a/tests/ui/issues/issue-27042.stderr
+++ b/tests/ui/issues/issue-27042.stderr
@@ -40,6 +40,8 @@ error[E0308]: mismatched types
 LL | /         'c:
 LL | |         for _ in None { break }; // but here we cite the whole loop
    | |_______________________________^ expected `i32`, found `()`
+   |
+   = note: `for` loops evaluate to unit type `()`
 
 error[E0308]: mismatched types
   --> $DIR/issue-27042.rs:15:9
diff --git a/tests/ui/issues/issue-50585.stderr b/tests/ui/issues/issue-50585.stderr
index 13181f1cf7f..e7f13e63475 100644
--- a/tests/ui/issues/issue-50585.stderr
+++ b/tests/ui/issues/issue-50585.stderr
@@ -13,6 +13,12 @@ error[E0308]: mismatched types
    |
 LL |     |y: Vec<[(); for x in 0..2 {}]>| {};
    |                  ^^^^^^^^^^^^^^^^ expected `usize`, found `()`
+   |
+   = note: `for` loops evaluate to unit type `()`
+help: consider returning a value here
+   |
+LL |     |y: Vec<[(); for x in 0..2 {} /* `usize` value */]>| {};
+   |                                   +++++++++++++++++++
 
 error: aborting due to 2 previous errors