]> git.lizzy.rs Git - rust.git/blob - src/test/ui/rfc-2497-if-let-chains/disallowed-positions.stderr
Auto merge of #87150 - rusticstuff:simplify_wrapping_neg, r=m-ou-se
[rust.git] / src / test / ui / rfc-2497-if-let-chains / disallowed-positions.stderr
1 error: expressions must be enclosed in braces to be used as const generic arguments
2   --> $DIR/disallowed-positions.rs:236:9
3    |
4 LL |         true && let 1 = 1
5    |         ^^^^^^^^^^^^^^^^^
6    |
7 help: enclose the `const` expression in braces
8    |
9 LL |         { true && let 1 = 1 }
10    |         ^                   ^
11
12 error: `let` expressions are not supported here
13   --> $DIR/disallowed-positions.rs:32:9
14    |
15 LL |     if &let 0 = 0 {}
16    |         ^^^^^^^^^
17    |
18    = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
19
20 error: `let` expressions are not supported here
21   --> $DIR/disallowed-positions.rs:35:9
22    |
23 LL |     if !let 0 = 0 {}
24    |         ^^^^^^^^^
25    |
26    = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
27
28 error: `let` expressions are not supported here
29   --> $DIR/disallowed-positions.rs:36:9
30    |
31 LL |     if *let 0 = 0 {}
32    |         ^^^^^^^^^
33    |
34    = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
35
36 error: `let` expressions are not supported here
37   --> $DIR/disallowed-positions.rs:38:9
38    |
39 LL |     if -let 0 = 0 {}
40    |         ^^^^^^^^^
41    |
42    = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
43
44 error: `let` expressions are not supported here
45   --> $DIR/disallowed-positions.rs:46:9
46    |
47 LL |     if (let 0 = 0)? {}
48    |         ^^^^^^^^^
49    |
50    = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
51
52 error: `let` expressions are not supported here
53   --> $DIR/disallowed-positions.rs:50:16
54    |
55 LL |     if true || let 0 = 0 {}
56    |                ^^^^^^^^^
57    |
58    = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
59
60 error: `let` expressions are not supported here
61   --> $DIR/disallowed-positions.rs:51:17
62    |
63 LL |     if (true || let 0 = 0) {}
64    |                 ^^^^^^^^^
65    |
66    = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
67
68 error: `let` expressions are not supported here
69   --> $DIR/disallowed-positions.rs:52:25
70    |
71 LL |     if true && (true || let 0 = 0) {}
72    |                         ^^^^^^^^^
73    |
74    = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
75
76 error: `let` expressions are not supported here
77   --> $DIR/disallowed-positions.rs:53:25
78    |
79 LL |     if true || (true && let 0 = 0) {}
80    |                         ^^^^^^^^^
81    |
82    = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
83
84 error: `let` expressions are not supported here
85   --> $DIR/disallowed-positions.rs:56:12
86    |
87 LL |     if x = let 0 = 0 {}
88    |            ^^^^^^^^^
89    |
90    = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
91
92 error: `let` expressions are not supported here
93   --> $DIR/disallowed-positions.rs:59:15
94    |
95 LL |     if true..(let 0 = 0) {}
96    |               ^^^^^^^^^
97    |
98    = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
99
100 error: `let` expressions are not supported here
101   --> $DIR/disallowed-positions.rs:61:11
102    |
103 LL |     if ..(let 0 = 0) {}
104    |           ^^^^^^^^^
105    |
106    = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
107
108 error: `let` expressions are not supported here
109   --> $DIR/disallowed-positions.rs:63:9
110    |
111 LL |     if (let 0 = 0).. {}
112    |         ^^^^^^^^^
113    |
114    = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
115
116 error: `let` expressions are not supported here
117   --> $DIR/disallowed-positions.rs:67:8
118    |
119 LL |     if let Range { start: _, end: _ } = true..true && false {}
120    |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
121    |
122    = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
123
124 error: `let` expressions are not supported here
125   --> $DIR/disallowed-positions.rs:71:8
126    |
127 LL |     if let Range { start: _, end: _ } = true..true || false {}
128    |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
129    |
130    = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
131
132 error: `let` expressions are not supported here
133   --> $DIR/disallowed-positions.rs:78:8
134    |
135 LL |     if let Range { start: F, end } = F..|| true {}
136    |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
137    |
138    = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
139
140 error: `let` expressions are not supported here
141   --> $DIR/disallowed-positions.rs:86:8
142    |
143 LL |     if let Range { start: true, end } = t..&&false {}
144    |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
145    |
146    = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
147
148 error: `let` expressions are not supported here
149   --> $DIR/disallowed-positions.rs:92:19
150    |
151 LL |     if let true = let true = true {}
152    |                   ^^^^^^^^^^^^^^^
153    |
154    = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
155
156 error: `let` expressions are not supported here
157   --> $DIR/disallowed-positions.rs:96:12
158    |
159 LL |     while &let 0 = 0 {}
160    |            ^^^^^^^^^
161    |
162    = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
163
164 error: `let` expressions are not supported here
165   --> $DIR/disallowed-positions.rs:99:12
166    |
167 LL |     while !let 0 = 0 {}
168    |            ^^^^^^^^^
169    |
170    = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
171
172 error: `let` expressions are not supported here
173   --> $DIR/disallowed-positions.rs:100:12
174    |
175 LL |     while *let 0 = 0 {}
176    |            ^^^^^^^^^
177    |
178    = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
179
180 error: `let` expressions are not supported here
181   --> $DIR/disallowed-positions.rs:102:12
182    |
183 LL |     while -let 0 = 0 {}
184    |            ^^^^^^^^^
185    |
186    = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
187
188 error: `let` expressions are not supported here
189   --> $DIR/disallowed-positions.rs:110:12
190    |
191 LL |     while (let 0 = 0)? {}
192    |            ^^^^^^^^^
193    |
194    = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
195
196 error: `let` expressions are not supported here
197   --> $DIR/disallowed-positions.rs:114:19
198    |
199 LL |     while true || let 0 = 0 {}
200    |                   ^^^^^^^^^
201    |
202    = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
203
204 error: `let` expressions are not supported here
205   --> $DIR/disallowed-positions.rs:115:20
206    |
207 LL |     while (true || let 0 = 0) {}
208    |                    ^^^^^^^^^
209    |
210    = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
211
212 error: `let` expressions are not supported here
213   --> $DIR/disallowed-positions.rs:116:28
214    |
215 LL |     while true && (true || let 0 = 0) {}
216    |                            ^^^^^^^^^
217    |
218    = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
219
220 error: `let` expressions are not supported here
221   --> $DIR/disallowed-positions.rs:117:28
222    |
223 LL |     while true || (true && let 0 = 0) {}
224    |                            ^^^^^^^^^
225    |
226    = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
227
228 error: `let` expressions are not supported here
229   --> $DIR/disallowed-positions.rs:120:15
230    |
231 LL |     while x = let 0 = 0 {}
232    |               ^^^^^^^^^
233    |
234    = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
235
236 error: `let` expressions are not supported here
237   --> $DIR/disallowed-positions.rs:123:18
238    |
239 LL |     while true..(let 0 = 0) {}
240    |                  ^^^^^^^^^
241    |
242    = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
243
244 error: `let` expressions are not supported here
245   --> $DIR/disallowed-positions.rs:125:14
246    |
247 LL |     while ..(let 0 = 0) {}
248    |              ^^^^^^^^^
249    |
250    = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
251
252 error: `let` expressions are not supported here
253   --> $DIR/disallowed-positions.rs:127:12
254    |
255 LL |     while (let 0 = 0).. {}
256    |            ^^^^^^^^^
257    |
258    = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
259
260 error: `let` expressions are not supported here
261   --> $DIR/disallowed-positions.rs:131:11
262    |
263 LL |     while let Range { start: _, end: _ } = true..true && false {}
264    |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
265    |
266    = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
267
268 error: `let` expressions are not supported here
269   --> $DIR/disallowed-positions.rs:135:11
270    |
271 LL |     while let Range { start: _, end: _ } = true..true || false {}
272    |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
273    |
274    = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
275
276 error: `let` expressions are not supported here
277   --> $DIR/disallowed-positions.rs:142:11
278    |
279 LL |     while let Range { start: F, end } = F..|| true {}
280    |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
281    |
282    = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
283
284 error: `let` expressions are not supported here
285   --> $DIR/disallowed-positions.rs:150:11
286    |
287 LL |     while let Range { start: true, end } = t..&&false {}
288    |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
289    |
290    = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
291
292 error: `let` expressions are not supported here
293   --> $DIR/disallowed-positions.rs:156:22
294    |
295 LL |     while let true = let true = true {}
296    |                      ^^^^^^^^^^^^^^^
297    |
298    = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
299
300 error: `let` expressions are not supported here
301   --> $DIR/disallowed-positions.rs:170:6
302    |
303 LL |     &let 0 = 0;
304    |      ^^^^^^^^^
305    |
306    = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
307
308 error: `let` expressions are not supported here
309   --> $DIR/disallowed-positions.rs:172:6
310    |
311 LL |     !let 0 = 0;
312    |      ^^^^^^^^^
313    |
314    = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
315
316 error: `let` expressions are not supported here
317   --> $DIR/disallowed-positions.rs:173:6
318    |
319 LL |     *let 0 = 0;
320    |      ^^^^^^^^^
321    |
322    = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
323
324 error: `let` expressions are not supported here
325   --> $DIR/disallowed-positions.rs:175:6
326    |
327 LL |     -let 0 = 0;
328    |      ^^^^^^^^^
329    |
330    = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
331
332 error: `let` expressions are not supported here
333   --> $DIR/disallowed-positions.rs:183:6
334    |
335 LL |     (let 0 = 0)?;
336    |      ^^^^^^^^^
337    |
338    = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
339
340 error: `let` expressions are not supported here
341   --> $DIR/disallowed-positions.rs:187:13
342    |
343 LL |     true || let 0 = 0;
344    |             ^^^^^^^^^
345    |
346    = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
347
348 error: `let` expressions are not supported here
349   --> $DIR/disallowed-positions.rs:188:14
350    |
351 LL |     (true || let 0 = 0);
352    |              ^^^^^^^^^
353    |
354    = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
355
356 error: `let` expressions are not supported here
357   --> $DIR/disallowed-positions.rs:189:22
358    |
359 LL |     true && (true || let 0 = 0);
360    |                      ^^^^^^^^^
361    |
362    = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
363
364 error: `let` expressions are not supported here
365   --> $DIR/disallowed-positions.rs:192:9
366    |
367 LL |     x = let 0 = 0;
368    |         ^^^^^^^^^
369    |
370    = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
371
372 error: `let` expressions are not supported here
373   --> $DIR/disallowed-positions.rs:194:12
374    |
375 LL |     true..(let 0 = 0);
376    |            ^^^^^^^^^
377    |
378    = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
379
380 error: `let` expressions are not supported here
381   --> $DIR/disallowed-positions.rs:195:8
382    |
383 LL |     ..(let 0 = 0);
384    |        ^^^^^^^^^
385    |
386    = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
387
388 error: `let` expressions are not supported here
389   --> $DIR/disallowed-positions.rs:196:6
390    |
391 LL |     (let 0 = 0)..;
392    |      ^^^^^^^^^
393    |
394    = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
395
396 error: `let` expressions are not supported here
397   --> $DIR/disallowed-positions.rs:198:6
398    |
399 LL |     (let Range { start: _, end: _ } = true..true || false);
400    |      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
401    |
402    = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
403
404 error: `let` expressions are not supported here
405   --> $DIR/disallowed-positions.rs:202:6
406    |
407 LL |     (let true = let true = true);
408    |      ^^^^^^^^^^^^^^^^^^^^^^^^^^
409    |
410    = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
411
412 error: `let` expressions are not supported here
413   --> $DIR/disallowed-positions.rs:202:17
414    |
415 LL |     (let true = let true = true);
416    |                 ^^^^^^^^^^^^^^^
417    |
418    = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
419
420 error: `let` expressions are not supported here
421   --> $DIR/disallowed-positions.rs:207:6
422    |
423 LL |     &let 0 = 0
424    |      ^^^^^^^^^
425    |
426    = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
427
428 error: `let` expressions are not supported here
429   --> $DIR/disallowed-positions.rs:218:17
430    |
431 LL |         true && let 1 = 1
432    |                 ^^^^^^^^^
433    |
434    = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
435
436 error: `let` expressions are not supported here
437   --> $DIR/disallowed-positions.rs:222:17
438    |
439 LL |         true && let 1 = 1
440    |                 ^^^^^^^^^
441    |
442    = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
443
444 error: `let` expressions are not supported here
445   --> $DIR/disallowed-positions.rs:226:17
446    |
447 LL |         true && let 1 = 1
448    |                 ^^^^^^^^^
449    |
450    = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
451
452 error: `let` expressions are not supported here
453   --> $DIR/disallowed-positions.rs:236:17
454    |
455 LL |         true && let 1 = 1
456    |                 ^^^^^^^^^
457    |
458    = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
459
460 warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes
461   --> $DIR/disallowed-positions.rs:20:12
462    |
463 LL | #![feature(const_generics)]
464    |            ^^^^^^^^^^^^^^
465    |
466    = note: `#[warn(incomplete_features)]` on by default
467    = note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
468
469 warning: the feature `let_chains` is incomplete and may not be safe to use and/or cause compiler crashes
470   --> $DIR/disallowed-positions.rs:22:12
471    |
472 LL | #![feature(let_chains)] // Avoid inflating `.stderr` with overzealous gates in this test.
473    |            ^^^^^^^^^^
474    |
475    = note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information
476
477 error[E0308]: mismatched types
478   --> $DIR/disallowed-positions.rs:32:8
479    |
480 LL |     if &let 0 = 0 {}
481    |        ^^^^^^^^^^ expected `bool`, found `&bool`
482    |
483 help: consider removing the borrow
484    |
485 LL |     if let 0 = 0 {}
486    |       --
487
488 error[E0614]: type `bool` cannot be dereferenced
489   --> $DIR/disallowed-positions.rs:36:8
490    |
491 LL |     if *let 0 = 0 {}
492    |        ^^^^^^^^^^
493
494 error[E0600]: cannot apply unary operator `-` to type `bool`
495   --> $DIR/disallowed-positions.rs:38:8
496    |
497 LL |     if -let 0 = 0 {}
498    |        ^^^^^^^^^^ cannot apply unary operator `-`
499
500 error[E0277]: the `?` operator can only be applied to values that implement `Try`
501   --> $DIR/disallowed-positions.rs:46:8
502    |
503 LL |     if (let 0 = 0)? {}
504    |        ^^^^^^^^^^^^ the `?` operator cannot be applied to type `bool`
505    |
506    = help: the trait `Try` is not implemented for `bool`
507 note: required by `branch`
508   --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL
509    |
510 LL |     fn branch(self) -> ControlFlow<Self::Residual, Self::Output>;
511    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
512
513 error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `FromResidual`)
514   --> $DIR/disallowed-positions.rs:46:19
515    |
516 LL | / fn nested_within_if_expr() {
517 LL | |     if &let 0 = 0 {}
518 LL | |
519 LL | |
520 ...  |
521 LL | |     if (let 0 = 0)? {}
522    | |                   ^ cannot use the `?` operator in a function that returns `()`
523 ...  |
524 LL | |     if let true = let true = true {}
525 LL | | }
526    | |_- this function should return `Result` or `Option` to accept `?`
527    |
528    = help: the trait `FromResidual<_>` is not implemented for `()`
529 note: required by `from_residual`
530   --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL
531    |
532 LL |     fn from_residual(residual: R) -> Self;
533    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
534
535 error[E0308]: mismatched types
536   --> $DIR/disallowed-positions.rs:56:8
537    |
538 LL |     if x = let 0 = 0 {}
539    |        ^^^^^^^^^^^^^ expected `bool`, found `()`
540    |
541 help: you might have meant to compare for equality
542    |
543 LL |     if x == let 0 = 0 {}
544    |          ^^
545
546 error[E0308]: mismatched types
547   --> $DIR/disallowed-positions.rs:59:8
548    |
549 LL |     if true..(let 0 = 0) {}
550    |        ^^^^^^^^^^^^^^^^^ expected `bool`, found struct `std::ops::Range`
551    |
552    = note: expected type `bool`
553             found struct `std::ops::Range<bool>`
554
555 error[E0308]: mismatched types
556   --> $DIR/disallowed-positions.rs:61:8
557    |
558 LL |     if ..(let 0 = 0) {}
559    |        ^^^^^^^^^^^^^ expected `bool`, found struct `RangeTo`
560    |
561    = note: expected type `bool`
562             found struct `RangeTo<bool>`
563
564 error[E0308]: mismatched types
565   --> $DIR/disallowed-positions.rs:63:8
566    |
567 LL |     if (let 0 = 0).. {}
568    |        ^^^^^^^^^^^^^ expected `bool`, found struct `RangeFrom`
569    |
570    = note: expected type `bool`
571             found struct `RangeFrom<bool>`
572
573 error[E0308]: mismatched types
574   --> $DIR/disallowed-positions.rs:67:12
575    |
576 LL |     if let Range { start: _, end: _ } = true..true && false {}
577    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^   ---- this expression has type `bool`
578    |            |
579    |            expected `bool`, found struct `std::ops::Range`
580    |
581    = note: expected type `bool`
582             found struct `std::ops::Range<_>`
583
584 error[E0308]: mismatched types
585   --> $DIR/disallowed-positions.rs:67:8
586    |
587 LL |     if let Range { start: _, end: _ } = true..true && false {}
588    |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found struct `std::ops::Range`
589    |
590    = note: expected type `bool`
591             found struct `std::ops::Range<bool>`
592
593 error[E0308]: mismatched types
594   --> $DIR/disallowed-positions.rs:71:12
595    |
596 LL |     if let Range { start: _, end: _ } = true..true || false {}
597    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^   ---- this expression has type `bool`
598    |            |
599    |            expected `bool`, found struct `std::ops::Range`
600    |
601    = note: expected type `bool`
602             found struct `std::ops::Range<_>`
603
604 error[E0308]: mismatched types
605   --> $DIR/disallowed-positions.rs:71:8
606    |
607 LL |     if let Range { start: _, end: _ } = true..true || false {}
608    |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found struct `std::ops::Range`
609    |
610    = note: expected type `bool`
611             found struct `std::ops::Range<bool>`
612
613 error[E0308]: mismatched types
614   --> $DIR/disallowed-positions.rs:78:12
615    |
616 LL |     if let Range { start: F, end } = F..|| true {}
617    |            ^^^^^^^^^^^^^^^^^^^^^^^ expected fn pointer, found struct `std::ops::Range`
618    |
619    = note: expected fn pointer `fn() -> bool`
620                   found struct `std::ops::Range<_>`
621
622 error[E0308]: mismatched types
623   --> $DIR/disallowed-positions.rs:78:41
624    |
625 LL |     if let Range { start: F, end } = F..|| true {}
626    |                                         ^^^^^^^ expected `bool`, found closure
627    |
628    = note: expected type `bool`
629            found closure `[closure@$DIR/disallowed-positions.rs:78:41: 78:48]`
630
631 error[E0308]: mismatched types
632   --> $DIR/disallowed-positions.rs:78:8
633    |
634 LL |     if let Range { start: F, end } = F..|| true {}
635    |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found struct `std::ops::Range`
636    |
637    = note: expected type `bool`
638             found struct `std::ops::Range<bool>`
639
640 error[E0308]: mismatched types
641   --> $DIR/disallowed-positions.rs:86:12
642    |
643 LL |     if let Range { start: true, end } = t..&&false {}
644    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^   - this expression has type `&&bool`
645    |            |
646    |            expected `bool`, found struct `std::ops::Range`
647    |
648    = note: expected type `bool`
649             found struct `std::ops::Range<_>`
650
651 error[E0308]: mismatched types
652   --> $DIR/disallowed-positions.rs:86:44
653    |
654 LL |     if let Range { start: true, end } = t..&&false {}
655    |                                            ^^^^^^^ expected `bool`, found `&&bool`
656
657 error[E0308]: mismatched types
658   --> $DIR/disallowed-positions.rs:86:8
659    |
660 LL |     if let Range { start: true, end } = t..&&false {}
661    |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found struct `std::ops::Range`
662    |
663    = note: expected type `bool`
664             found struct `std::ops::Range<bool>`
665
666 error[E0277]: the `?` operator can only be applied to values that implement `Try`
667   --> $DIR/disallowed-positions.rs:42:20
668    |
669 LL |         if let 0 = 0? {}
670    |                    ^^ the `?` operator cannot be applied to type `{integer}`
671    |
672    = help: the trait `Try` is not implemented for `{integer}`
673 note: required by `branch`
674   --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL
675    |
676 LL |     fn branch(self) -> ControlFlow<Self::Residual, Self::Output>;
677    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
678
679 error[E0308]: mismatched types
680   --> $DIR/disallowed-positions.rs:96:11
681    |
682 LL |     while &let 0 = 0 {}
683    |           ^^^^^^^^^^ expected `bool`, found `&bool`
684    |
685 help: consider removing the borrow
686    |
687 LL |     while let 0 = 0 {}
688    |          --
689
690 error[E0614]: type `bool` cannot be dereferenced
691   --> $DIR/disallowed-positions.rs:100:11
692    |
693 LL |     while *let 0 = 0 {}
694    |           ^^^^^^^^^^
695
696 error[E0600]: cannot apply unary operator `-` to type `bool`
697   --> $DIR/disallowed-positions.rs:102:11
698    |
699 LL |     while -let 0 = 0 {}
700    |           ^^^^^^^^^^ cannot apply unary operator `-`
701
702 error[E0277]: the `?` operator can only be applied to values that implement `Try`
703   --> $DIR/disallowed-positions.rs:110:11
704    |
705 LL |     while (let 0 = 0)? {}
706    |           ^^^^^^^^^^^^ the `?` operator cannot be applied to type `bool`
707    |
708    = help: the trait `Try` is not implemented for `bool`
709 note: required by `branch`
710   --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL
711    |
712 LL |     fn branch(self) -> ControlFlow<Self::Residual, Self::Output>;
713    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
714
715 error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `FromResidual`)
716   --> $DIR/disallowed-positions.rs:110:22
717    |
718 LL | / fn nested_within_while_expr() {
719 LL | |     while &let 0 = 0 {}
720 LL | |
721 LL | |
722 ...  |
723 LL | |     while (let 0 = 0)? {}
724    | |                      ^ cannot use the `?` operator in a function that returns `()`
725 ...  |
726 LL | |     while let true = let true = true {}
727 LL | | }
728    | |_- this function should return `Result` or `Option` to accept `?`
729    |
730    = help: the trait `FromResidual<_>` is not implemented for `()`
731 note: required by `from_residual`
732   --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL
733    |
734 LL |     fn from_residual(residual: R) -> Self;
735    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
736
737 error[E0308]: mismatched types
738   --> $DIR/disallowed-positions.rs:120:11
739    |
740 LL |     while x = let 0 = 0 {}
741    |           ^^^^^^^^^^^^^ expected `bool`, found `()`
742    |
743 help: you might have meant to compare for equality
744    |
745 LL |     while x == let 0 = 0 {}
746    |             ^^
747
748 error[E0308]: mismatched types
749   --> $DIR/disallowed-positions.rs:123:11
750    |
751 LL |     while true..(let 0 = 0) {}
752    |           ^^^^^^^^^^^^^^^^^ expected `bool`, found struct `std::ops::Range`
753    |
754    = note: expected type `bool`
755             found struct `std::ops::Range<bool>`
756
757 error[E0308]: mismatched types
758   --> $DIR/disallowed-positions.rs:125:11
759    |
760 LL |     while ..(let 0 = 0) {}
761    |           ^^^^^^^^^^^^^ expected `bool`, found struct `RangeTo`
762    |
763    = note: expected type `bool`
764             found struct `RangeTo<bool>`
765
766 error[E0308]: mismatched types
767   --> $DIR/disallowed-positions.rs:127:11
768    |
769 LL |     while (let 0 = 0).. {}
770    |           ^^^^^^^^^^^^^ expected `bool`, found struct `RangeFrom`
771    |
772    = note: expected type `bool`
773             found struct `RangeFrom<bool>`
774
775 error[E0308]: mismatched types
776   --> $DIR/disallowed-positions.rs:131:15
777    |
778 LL |     while let Range { start: _, end: _ } = true..true && false {}
779    |               ^^^^^^^^^^^^^^^^^^^^^^^^^^   ---- this expression has type `bool`
780    |               |
781    |               expected `bool`, found struct `std::ops::Range`
782    |
783    = note: expected type `bool`
784             found struct `std::ops::Range<_>`
785
786 error[E0308]: mismatched types
787   --> $DIR/disallowed-positions.rs:131:11
788    |
789 LL |     while let Range { start: _, end: _ } = true..true && false {}
790    |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found struct `std::ops::Range`
791    |
792    = note: expected type `bool`
793             found struct `std::ops::Range<bool>`
794
795 error[E0308]: mismatched types
796   --> $DIR/disallowed-positions.rs:135:15
797    |
798 LL |     while let Range { start: _, end: _ } = true..true || false {}
799    |               ^^^^^^^^^^^^^^^^^^^^^^^^^^   ---- this expression has type `bool`
800    |               |
801    |               expected `bool`, found struct `std::ops::Range`
802    |
803    = note: expected type `bool`
804             found struct `std::ops::Range<_>`
805
806 error[E0308]: mismatched types
807   --> $DIR/disallowed-positions.rs:135:11
808    |
809 LL |     while let Range { start: _, end: _ } = true..true || false {}
810    |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found struct `std::ops::Range`
811    |
812    = note: expected type `bool`
813             found struct `std::ops::Range<bool>`
814
815 error[E0308]: mismatched types
816   --> $DIR/disallowed-positions.rs:142:15
817    |
818 LL |     while let Range { start: F, end } = F..|| true {}
819    |               ^^^^^^^^^^^^^^^^^^^^^^^ expected fn pointer, found struct `std::ops::Range`
820    |
821    = note: expected fn pointer `fn() -> bool`
822                   found struct `std::ops::Range<_>`
823
824 error[E0308]: mismatched types
825   --> $DIR/disallowed-positions.rs:142:44
826    |
827 LL |     while let Range { start: F, end } = F..|| true {}
828    |                                            ^^^^^^^ expected `bool`, found closure
829    |
830    = note: expected type `bool`
831            found closure `[closure@$DIR/disallowed-positions.rs:142:44: 142:51]`
832
833 error[E0308]: mismatched types
834   --> $DIR/disallowed-positions.rs:142:11
835    |
836 LL |     while let Range { start: F, end } = F..|| true {}
837    |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found struct `std::ops::Range`
838    |
839    = note: expected type `bool`
840             found struct `std::ops::Range<bool>`
841
842 error[E0308]: mismatched types
843   --> $DIR/disallowed-positions.rs:150:15
844    |
845 LL |     while let Range { start: true, end } = t..&&false {}
846    |               ^^^^^^^^^^^^^^^^^^^^^^^^^^   - this expression has type `&&bool`
847    |               |
848    |               expected `bool`, found struct `std::ops::Range`
849    |
850    = note: expected type `bool`
851             found struct `std::ops::Range<_>`
852
853 error[E0308]: mismatched types
854   --> $DIR/disallowed-positions.rs:150:47
855    |
856 LL |     while let Range { start: true, end } = t..&&false {}
857    |                                               ^^^^^^^ expected `bool`, found `&&bool`
858
859 error[E0308]: mismatched types
860   --> $DIR/disallowed-positions.rs:150:11
861    |
862 LL |     while let Range { start: true, end } = t..&&false {}
863    |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found struct `std::ops::Range`
864    |
865    = note: expected type `bool`
866             found struct `std::ops::Range<bool>`
867
868 error[E0277]: the `?` operator can only be applied to values that implement `Try`
869   --> $DIR/disallowed-positions.rs:106:23
870    |
871 LL |         while let 0 = 0? {}
872    |                       ^^ the `?` operator cannot be applied to type `{integer}`
873    |
874    = help: the trait `Try` is not implemented for `{integer}`
875 note: required by `branch`
876   --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL
877    |
878 LL |     fn branch(self) -> ControlFlow<Self::Residual, Self::Output>;
879    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
880
881 error[E0614]: type `bool` cannot be dereferenced
882   --> $DIR/disallowed-positions.rs:173:5
883    |
884 LL |     *let 0 = 0;
885    |     ^^^^^^^^^^
886
887 error[E0600]: cannot apply unary operator `-` to type `bool`
888   --> $DIR/disallowed-positions.rs:175:5
889    |
890 LL |     -let 0 = 0;
891    |     ^^^^^^^^^^ cannot apply unary operator `-`
892
893 error[E0277]: the `?` operator can only be applied to values that implement `Try`
894   --> $DIR/disallowed-positions.rs:183:5
895    |
896 LL |     (let 0 = 0)?;
897    |     ^^^^^^^^^^^^ the `?` operator cannot be applied to type `bool`
898    |
899    = help: the trait `Try` is not implemented for `bool`
900 note: required by `branch`
901   --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL
902    |
903 LL |     fn branch(self) -> ControlFlow<Self::Residual, Self::Output>;
904    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
905
906 error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `FromResidual`)
907   --> $DIR/disallowed-positions.rs:183:16
908    |
909 LL | / fn outside_if_and_while_expr() {
910 LL | |     &let 0 = 0;
911 LL | |
912 LL | |     !let 0 = 0;
913 ...  |
914 LL | |     (let 0 = 0)?;
915    | |                ^ cannot use the `?` operator in a function that returns `()`
916 ...  |
917 LL | |
918 LL | | }
919    | |_- this function should return `Result` or `Option` to accept `?`
920    |
921    = help: the trait `FromResidual<_>` is not implemented for `()`
922 note: required by `from_residual`
923   --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL
924    |
925 LL |     fn from_residual(residual: R) -> Self;
926    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
927
928 error[E0308]: mismatched types
929   --> $DIR/disallowed-positions.rs:198:10
930    |
931 LL |     (let Range { start: _, end: _ } = true..true || false);
932    |          ^^^^^^^^^^^^^^^^^^^^^^^^^^   ---- this expression has type `bool`
933    |          |
934    |          expected `bool`, found struct `std::ops::Range`
935    |
936    = note: expected type `bool`
937             found struct `std::ops::Range<_>`
938
939 error[E0308]: mismatched types
940   --> $DIR/disallowed-positions.rs:207:5
941    |
942 LL | fn outside_if_and_while_expr() {
943    |                                - help: try adding a return type: `-> &bool`
944 ...
945 LL |     &let 0 = 0
946    |     ^^^^^^^^^^ expected `()`, found `&bool`
947
948 error[E0277]: the `?` operator can only be applied to values that implement `Try`
949   --> $DIR/disallowed-positions.rs:179:17
950    |
951 LL |         let 0 = 0?;
952    |                 ^^ the `?` operator cannot be applied to type `{integer}`
953    |
954    = help: the trait `Try` is not implemented for `{integer}`
955 note: required by `branch`
956   --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL
957    |
958 LL |     fn branch(self) -> ControlFlow<Self::Residual, Self::Output>;
959    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
960
961 error: aborting due to 104 previous errors; 2 warnings emitted
962
963 Some errors have detailed explanations: E0277, E0308, E0600, E0614.
964 For more information about an error, try `rustc --explain E0277`.