@@ -98,6 +98,16 @@ LL | | }
9898 | |_____^ expected `bool`, found `()`
9999 |
100100 = note: `for` loops evaluate to unit type `()`
101+ note: It is determined that this might iterate zero times, regardless of the iterator expression.
102+ --> $DIR/coerce-loop-issue-122561.rs:4:5
103+ |
104+ LL | for i in 0.. {
105+ | ^^^^^^^^^^^^
106+ help: If you are assuming that it will iterate more than once, consider using a `loop` expression instead.
107+ --> $DIR/coerce-loop-issue-122561.rs:4:5
108+ |
109+ LL | for i in 0.. {
110+ | ^^^^^^^^^^^^
101111help: consider returning a value here
102112 |
103113LL ~ }
@@ -116,6 +126,16 @@ LL | | }
116126 | |_____^ expected `String`, found `()`
117127 |
118128 = note: `for` loops evaluate to unit type `()`
129+ note: It is determined that this might iterate zero times, regardless of the iterator expression.
130+ --> $DIR/coerce-loop-issue-122561.rs:11:5
131+ |
132+ LL | for i in 0..5 {
133+ | ^^^^^^^^^^^^^
134+ help: If you are assuming that it will iterate more than once, consider using a `loop` expression instead.
135+ --> $DIR/coerce-loop-issue-122561.rs:11:5
136+ |
137+ LL | for i in 0..5 {
138+ | ^^^^^^^^^^^^^
119139help: consider returning a value here
120140 |
121141LL ~ }
@@ -134,6 +154,16 @@ LL | | }
134154 | |_____^ expected `bool`, found `()`
135155 |
136156 = note: `for` loops evaluate to unit type `()`
157+ note: It is determined that this might iterate zero times, regardless of the iterator expression.
158+ --> $DIR/coerce-loop-issue-122561.rs:18:5
159+ |
160+ LL | for i in 0..0 {
161+ | ^^^^^^^^^^^^^
162+ help: If you are assuming that it will iterate more than once, consider using a `loop` expression instead.
163+ --> $DIR/coerce-loop-issue-122561.rs:18:5
164+ |
165+ LL | for i in 0..0 {
166+ | ^^^^^^^^^^^^^
137167help: consider returning a value here
138168 |
139169LL ~ }
@@ -168,6 +198,16 @@ LL | fn for_single_line() -> bool { for i in 0.. { return false; } }
168198 | expected `bool` because of return type
169199 |
170200 = note: `for` loops evaluate to unit type `()`
201+ note: It is determined that this might iterate zero times, regardless of the iterator expression.
202+ --> $DIR/coerce-loop-issue-122561.rs:33:32
203+ |
204+ LL | fn for_single_line() -> bool { for i in 0.. { return false; } }
205+ | ^^^^^^^^^^^^
206+ help: If you are assuming that it will iterate more than once, consider using a `loop` expression instead.
207+ --> $DIR/coerce-loop-issue-122561.rs:33:32
208+ |
209+ LL | fn for_single_line() -> bool { for i in 0.. { return false; } }
210+ | ^^^^^^^^^^^^
171211help: consider returning a value here
172212 |
173213LL | fn for_single_line() -> bool { for i in 0.. { return false; } /* `bool` value */ }
@@ -186,6 +226,16 @@ LL | | }
186226 | |_____^ expected `bool`, found `()`
187227 |
188228 = note: `while` loops evaluate to unit type `()`
229+ note: It is determined that this might iterate zero times, regardless of the loop condition expression or pattern.
230+ --> $DIR/coerce-loop-issue-122561.rs:48:5
231+ |
232+ LL | while true {
233+ | ^^^^^^^^^^
234+ help: If you are assuming that it will iterate more than once, consider using a `loop` expression instead.
235+ --> $DIR/coerce-loop-issue-122561.rs:48:5
236+ |
237+ LL | while true {
238+ | ^^^^^^^^^^
189239help: consider returning a value here
190240 |
191241LL ~ }
@@ -206,6 +256,16 @@ LL | | }
206256 | |_____^ expected `bool`, found `()`
207257 |
208258 = note: `while` loops evaluate to unit type `()`
259+ note: It is determined that this might iterate zero times, regardless of the loop condition expression or pattern.
260+ --> $DIR/coerce-loop-issue-122561.rs:57:5
261+ |
262+ LL | while i < 3 {
263+ | ^^^^^^^^^^^
264+ help: If you are assuming that it will iterate more than once, consider using a `loop` expression instead.
265+ --> $DIR/coerce-loop-issue-122561.rs:57:5
266+ |
267+ LL | while i < 3 {
268+ | ^^^^^^^^^^^
209269help: consider returning a value here
210270 |
211271LL ~ }
@@ -224,6 +284,16 @@ LL | | }
224284 | |_____^ expected `bool`, found `()`
225285 |
226286 = note: `while` loops evaluate to unit type `()`
287+ note: It is determined that this might iterate zero times, regardless of the loop condition expression or pattern.
288+ --> $DIR/coerce-loop-issue-122561.rs:65:5
289+ |
290+ LL | while false {
291+ | ^^^^^^^^^^^
292+ help: If you are assuming that it will iterate more than once, consider using a `loop` expression instead.
293+ --> $DIR/coerce-loop-issue-122561.rs:65:5
294+ |
295+ LL | while false {
296+ | ^^^^^^^^^^^
227297help: consider returning a value here
228298 |
229299LL ~ }
0 commit comments