@@ -7,7 +7,7 @@ LL | while true {
77 = note: `#[warn(while_true)]` on by default
88
99warning: denote infinite loops with `loop { ... }`
10- --> $DIR/coerce-loop-issue-122561.rs:73 :5
10+ --> $DIR/coerce-loop-issue-122561.rs:91 :5
1111 |
1212LL | while true {
1313 | ^^^^^^^^^^ help: use `loop`
@@ -171,6 +171,56 @@ LL + /* `bool` value */
171171error[E0308]: mismatched types
172172 --> $DIR/coerce-loop-issue-122561.rs:73:5
173173 |
174+ LL | fn while_let_binding() -> bool {
175+ | ---- expected `bool` because of return type
176+ LL | / while let x = false {
177+ LL | |
178+ LL | | if x {
179+ LL | | return true;
180+ LL | | }
181+ LL | | }
182+ | |_____^ expected `bool`, found `()`
183+ |
184+ = note: `while` loops evaluate to unit type `()`
185+ note: this pattern always matches, so the loop condition never fails
186+ --> $DIR/coerce-loop-issue-122561.rs:73:15
187+ |
188+ LL | while let x = false {
189+ | ^
190+ help: consider returning a value here
191+ |
192+ LL ~ }
193+ LL + /* `bool` value */
194+ |
195+
196+ error[E0308]: mismatched types
197+ --> $DIR/coerce-loop-issue-122561.rs:82:5
198+ |
199+ LL | fn while_let_tuple() -> bool {
200+ | ---- expected `bool` because of return type
201+ LL | / while let (x, _) = (false, true) {
202+ LL | |
203+ LL | | if x {
204+ LL | | return true;
205+ LL | | }
206+ LL | | }
207+ | |_____^ expected `bool`, found `()`
208+ |
209+ = note: `while` loops evaluate to unit type `()`
210+ note: this pattern always matches, so the loop condition never fails
211+ --> $DIR/coerce-loop-issue-122561.rs:82:15
212+ |
213+ LL | while let (x, _) = (false, true) {
214+ | ^^^^^^
215+ help: consider returning a value here
216+ |
217+ LL ~ }
218+ LL + /* `bool` value */
219+ |
220+
221+ error[E0308]: mismatched types
222+ --> $DIR/coerce-loop-issue-122561.rs:91:5
223+ |
174224LL | fn while_never_type() -> ! {
175225 | - expected `!` because of return type
176226LL | / while true {
@@ -188,7 +238,7 @@ LL + /* `loop {}` or `panic!("...")` */
188238 |
189239
190240error[E0308]: mismatched types
191- --> $DIR/coerce-loop-issue-122561.rs:87 :5
241+ --> $DIR/coerce-loop-issue-122561.rs:105 :5
192242 |
193243LL | / for i in 0.. {
194244LL | |
@@ -203,7 +253,7 @@ LL + /* `i32` value */
203253 |
204254
205255error[E0308]: mismatched types
206- --> $DIR/coerce-loop-issue-122561.rs:94 :9
256+ --> $DIR/coerce-loop-issue-122561.rs:112 :9
207257 |
208258LL | / for i in 0..5 {
209259LL | |
@@ -218,7 +268,7 @@ LL + /* `usize` value */
218268 |
219269
220270error[E0308]: mismatched types
221- --> $DIR/coerce-loop-issue-122561.rs:100 :9
271+ --> $DIR/coerce-loop-issue-122561.rs:118 :9
222272 |
223273LL | / while false {
224274LL | |
@@ -233,7 +283,7 @@ LL + /* `usize` value */
233283 |
234284
235285error[E0308]: mismatched types
236- --> $DIR/coerce-loop-issue-122561.rs:106 :23
286+ --> $DIR/coerce-loop-issue-122561.rs:124 :23
237287 |
238288LL | let _ = |a: &[(); for x in 0..2 {}]| {};
239289 | ^^^^^^^^^^^^^^^^ expected `usize`, found `()`
@@ -244,6 +294,6 @@ help: consider returning a value here
244294LL | let _ = |a: &[(); for x in 0..2 {} /* `usize` value */]| {};
245295 | +++++++++++++++++++
246296
247- error: aborting due to 14 previous errors; 2 warnings emitted
297+ error: aborting due to 16 previous errors; 2 warnings emitted
248298
249299For more information about this error, try `rustc --explain E0308`.
0 commit comments