]> git.lizzy.rs Git - rust.git/blob - src/test/ui/rfc-2497-if-let-chains/disallowed-positions.stderr
Allow combining -Cprofile-generate and -Cpanic=unwind when targeting
[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    |        ^^^^^^^^^^
482    |        |
483    |        expected `bool`, found `&bool`
484    |        help: consider removing the borrow: `let 0 = 0`
485
486 error[E0614]: type `bool` cannot be dereferenced
487   --> $DIR/disallowed-positions.rs:36:8
488    |
489 LL |     if *let 0 = 0 {}
490    |        ^^^^^^^^^^
491
492 error[E0600]: cannot apply unary operator `-` to type `bool`
493   --> $DIR/disallowed-positions.rs:38:8
494    |
495 LL |     if -let 0 = 0 {}
496    |        ^^^^^^^^^^ cannot apply unary operator `-`
497
498 error[E0277]: the `?` operator can only be applied to values that implement `Try`
499   --> $DIR/disallowed-positions.rs:46:8
500    |
501 LL |     if (let 0 = 0)? {}
502    |        ^^^^^^^^^^^^ the `?` operator cannot be applied to type `bool`
503    |
504    = help: the trait `Try` is not implemented for `bool`
505    = note: required by `branch`
506
507 error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `FromResidual`)
508   --> $DIR/disallowed-positions.rs:46:19
509    |
510 LL | / fn nested_within_if_expr() {
511 LL | |     if &let 0 = 0 {}
512 LL | |
513 LL | |
514 ...  |
515 LL | |     if (let 0 = 0)? {}
516    | |                   ^ cannot use the `?` operator in a function that returns `()`
517 ...  |
518 LL | |     if let true = let true = true {}
519 LL | | }
520    | |_- this function should return `Result` or `Option` to accept `?`
521    |
522    = help: the trait `FromResidual<_>` is not implemented for `()`
523    = note: required by `from_residual`
524
525 error[E0308]: mismatched types
526   --> $DIR/disallowed-positions.rs:56:8
527    |
528 LL |     if x = let 0 = 0 {}
529    |        ^^^^^^^^^^^^^ expected `bool`, found `()`
530    |
531 help: you might have meant to compare for equality
532    |
533 LL |     if x == let 0 = 0 {}
534    |          ^^
535
536 error[E0308]: mismatched types
537   --> $DIR/disallowed-positions.rs:59:8
538    |
539 LL |     if true..(let 0 = 0) {}
540    |        ^^^^^^^^^^^^^^^^^ expected `bool`, found struct `std::ops::Range`
541    |
542    = note: expected type `bool`
543             found struct `std::ops::Range<bool>`
544
545 error[E0308]: mismatched types
546   --> $DIR/disallowed-positions.rs:61:8
547    |
548 LL |     if ..(let 0 = 0) {}
549    |        ^^^^^^^^^^^^^ expected `bool`, found struct `RangeTo`
550    |
551    = note: expected type `bool`
552             found struct `RangeTo<bool>`
553
554 error[E0308]: mismatched types
555   --> $DIR/disallowed-positions.rs:63:8
556    |
557 LL |     if (let 0 = 0).. {}
558    |        ^^^^^^^^^^^^^ expected `bool`, found struct `RangeFrom`
559    |
560    = note: expected type `bool`
561             found struct `RangeFrom<bool>`
562
563 error[E0308]: mismatched types
564   --> $DIR/disallowed-positions.rs:67:12
565    |
566 LL |     if let Range { start: _, end: _ } = true..true && false {}
567    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^   ---- this expression has type `bool`
568    |            |
569    |            expected `bool`, found struct `std::ops::Range`
570    |
571    = note: expected type `bool`
572             found struct `std::ops::Range<_>`
573
574 error[E0308]: mismatched types
575   --> $DIR/disallowed-positions.rs:67:8
576    |
577 LL |     if let Range { start: _, end: _ } = true..true && false {}
578    |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found struct `std::ops::Range`
579    |
580    = note: expected type `bool`
581             found struct `std::ops::Range<bool>`
582
583 error[E0308]: mismatched types
584   --> $DIR/disallowed-positions.rs:71:12
585    |
586 LL |     if let Range { start: _, end: _ } = true..true || false {}
587    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^   ---- this expression has type `bool`
588    |            |
589    |            expected `bool`, found struct `std::ops::Range`
590    |
591    = note: expected type `bool`
592             found struct `std::ops::Range<_>`
593
594 error[E0308]: mismatched types
595   --> $DIR/disallowed-positions.rs:71:8
596    |
597 LL |     if let Range { start: _, end: _ } = true..true || false {}
598    |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found struct `std::ops::Range`
599    |
600    = note: expected type `bool`
601             found struct `std::ops::Range<bool>`
602
603 error[E0308]: mismatched types
604   --> $DIR/disallowed-positions.rs:78:12
605    |
606 LL |     if let Range { start: F, end } = F..|| true {}
607    |            ^^^^^^^^^^^^^^^^^^^^^^^ expected fn pointer, found struct `std::ops::Range`
608    |
609    = note: expected fn pointer `fn() -> bool`
610                   found struct `std::ops::Range<_>`
611
612 error[E0308]: mismatched types
613   --> $DIR/disallowed-positions.rs:78:41
614    |
615 LL |     if let Range { start: F, end } = F..|| true {}
616    |                                         ^^^^^^^ expected `bool`, found closure
617    |
618    = note: expected type `bool`
619            found closure `[closure@$DIR/disallowed-positions.rs:78:41: 78:48]`
620
621 error[E0308]: mismatched types
622   --> $DIR/disallowed-positions.rs:78:8
623    |
624 LL |     if let Range { start: F, end } = F..|| true {}
625    |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found struct `std::ops::Range`
626    |
627    = note: expected type `bool`
628             found struct `std::ops::Range<bool>`
629
630 error[E0308]: mismatched types
631   --> $DIR/disallowed-positions.rs:86:12
632    |
633 LL |     if let Range { start: true, end } = t..&&false {}
634    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^   - this expression has type `&&bool`
635    |            |
636    |            expected `bool`, found struct `std::ops::Range`
637    |
638    = note: expected type `bool`
639             found struct `std::ops::Range<_>`
640
641 error[E0308]: mismatched types
642   --> $DIR/disallowed-positions.rs:86:44
643    |
644 LL |     if let Range { start: true, end } = t..&&false {}
645    |                                            ^^^^^^^ expected `bool`, found `&&bool`
646
647 error[E0308]: mismatched types
648   --> $DIR/disallowed-positions.rs:86:8
649    |
650 LL |     if let Range { start: true, end } = t..&&false {}
651    |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found struct `std::ops::Range`
652    |
653    = note: expected type `bool`
654             found struct `std::ops::Range<bool>`
655
656 error[E0277]: the `?` operator can only be applied to values that implement `Try`
657   --> $DIR/disallowed-positions.rs:42:20
658    |
659 LL |         if let 0 = 0? {}
660    |                    ^^ the `?` operator cannot be applied to type `{integer}`
661    |
662    = help: the trait `Try` is not implemented for `{integer}`
663    = note: required by `branch`
664
665 error[E0308]: mismatched types
666   --> $DIR/disallowed-positions.rs:96:11
667    |
668 LL |     while &let 0 = 0 {}
669    |           ^^^^^^^^^^
670    |           |
671    |           expected `bool`, found `&bool`
672    |           help: consider removing the borrow: `let 0 = 0`
673
674 error[E0614]: type `bool` cannot be dereferenced
675   --> $DIR/disallowed-positions.rs:100:11
676    |
677 LL |     while *let 0 = 0 {}
678    |           ^^^^^^^^^^
679
680 error[E0600]: cannot apply unary operator `-` to type `bool`
681   --> $DIR/disallowed-positions.rs:102:11
682    |
683 LL |     while -let 0 = 0 {}
684    |           ^^^^^^^^^^ cannot apply unary operator `-`
685
686 error[E0277]: the `?` operator can only be applied to values that implement `Try`
687   --> $DIR/disallowed-positions.rs:110:11
688    |
689 LL |     while (let 0 = 0)? {}
690    |           ^^^^^^^^^^^^ the `?` operator cannot be applied to type `bool`
691    |
692    = help: the trait `Try` is not implemented for `bool`
693    = note: required by `branch`
694
695 error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `FromResidual`)
696   --> $DIR/disallowed-positions.rs:110:22
697    |
698 LL | / fn nested_within_while_expr() {
699 LL | |     while &let 0 = 0 {}
700 LL | |
701 LL | |
702 ...  |
703 LL | |     while (let 0 = 0)? {}
704    | |                      ^ cannot use the `?` operator in a function that returns `()`
705 ...  |
706 LL | |     while let true = let true = true {}
707 LL | | }
708    | |_- this function should return `Result` or `Option` to accept `?`
709    |
710    = help: the trait `FromResidual<_>` is not implemented for `()`
711    = note: required by `from_residual`
712
713 error[E0308]: mismatched types
714   --> $DIR/disallowed-positions.rs:120:11
715    |
716 LL |     while x = let 0 = 0 {}
717    |           ^^^^^^^^^^^^^ expected `bool`, found `()`
718    |
719 help: you might have meant to compare for equality
720    |
721 LL |     while x == let 0 = 0 {}
722    |             ^^
723
724 error[E0308]: mismatched types
725   --> $DIR/disallowed-positions.rs:123:11
726    |
727 LL |     while true..(let 0 = 0) {}
728    |           ^^^^^^^^^^^^^^^^^ expected `bool`, found struct `std::ops::Range`
729    |
730    = note: expected type `bool`
731             found struct `std::ops::Range<bool>`
732
733 error[E0308]: mismatched types
734   --> $DIR/disallowed-positions.rs:125:11
735    |
736 LL |     while ..(let 0 = 0) {}
737    |           ^^^^^^^^^^^^^ expected `bool`, found struct `RangeTo`
738    |
739    = note: expected type `bool`
740             found struct `RangeTo<bool>`
741
742 error[E0308]: mismatched types
743   --> $DIR/disallowed-positions.rs:127:11
744    |
745 LL |     while (let 0 = 0).. {}
746    |           ^^^^^^^^^^^^^ expected `bool`, found struct `RangeFrom`
747    |
748    = note: expected type `bool`
749             found struct `RangeFrom<bool>`
750
751 error[E0308]: mismatched types
752   --> $DIR/disallowed-positions.rs:131:15
753    |
754 LL |     while let Range { start: _, end: _ } = true..true && false {}
755    |               ^^^^^^^^^^^^^^^^^^^^^^^^^^   ---- this expression has type `bool`
756    |               |
757    |               expected `bool`, found struct `std::ops::Range`
758    |
759    = note: expected type `bool`
760             found struct `std::ops::Range<_>`
761
762 error[E0308]: mismatched types
763   --> $DIR/disallowed-positions.rs:131:11
764    |
765 LL |     while let Range { start: _, end: _ } = true..true && false {}
766    |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found struct `std::ops::Range`
767    |
768    = note: expected type `bool`
769             found struct `std::ops::Range<bool>`
770
771 error[E0308]: mismatched types
772   --> $DIR/disallowed-positions.rs:135:15
773    |
774 LL |     while let Range { start: _, end: _ } = true..true || false {}
775    |               ^^^^^^^^^^^^^^^^^^^^^^^^^^   ---- this expression has type `bool`
776    |               |
777    |               expected `bool`, found struct `std::ops::Range`
778    |
779    = note: expected type `bool`
780             found struct `std::ops::Range<_>`
781
782 error[E0308]: mismatched types
783   --> $DIR/disallowed-positions.rs:135:11
784    |
785 LL |     while let Range { start: _, end: _ } = true..true || false {}
786    |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found struct `std::ops::Range`
787    |
788    = note: expected type `bool`
789             found struct `std::ops::Range<bool>`
790
791 error[E0308]: mismatched types
792   --> $DIR/disallowed-positions.rs:142:15
793    |
794 LL |     while let Range { start: F, end } = F..|| true {}
795    |               ^^^^^^^^^^^^^^^^^^^^^^^ expected fn pointer, found struct `std::ops::Range`
796    |
797    = note: expected fn pointer `fn() -> bool`
798                   found struct `std::ops::Range<_>`
799
800 error[E0308]: mismatched types
801   --> $DIR/disallowed-positions.rs:142:44
802    |
803 LL |     while let Range { start: F, end } = F..|| true {}
804    |                                            ^^^^^^^ expected `bool`, found closure
805    |
806    = note: expected type `bool`
807            found closure `[closure@$DIR/disallowed-positions.rs:142:44: 142:51]`
808
809 error[E0308]: mismatched types
810   --> $DIR/disallowed-positions.rs:142:11
811    |
812 LL |     while let Range { start: F, end } = F..|| true {}
813    |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found struct `std::ops::Range`
814    |
815    = note: expected type `bool`
816             found struct `std::ops::Range<bool>`
817
818 error[E0308]: mismatched types
819   --> $DIR/disallowed-positions.rs:150:15
820    |
821 LL |     while let Range { start: true, end } = t..&&false {}
822    |               ^^^^^^^^^^^^^^^^^^^^^^^^^^   - this expression has type `&&bool`
823    |               |
824    |               expected `bool`, found struct `std::ops::Range`
825    |
826    = note: expected type `bool`
827             found struct `std::ops::Range<_>`
828
829 error[E0308]: mismatched types
830   --> $DIR/disallowed-positions.rs:150:47
831    |
832 LL |     while let Range { start: true, end } = t..&&false {}
833    |                                               ^^^^^^^ expected `bool`, found `&&bool`
834
835 error[E0308]: mismatched types
836   --> $DIR/disallowed-positions.rs:150:11
837    |
838 LL |     while let Range { start: true, end } = t..&&false {}
839    |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found struct `std::ops::Range`
840    |
841    = note: expected type `bool`
842             found struct `std::ops::Range<bool>`
843
844 error[E0277]: the `?` operator can only be applied to values that implement `Try`
845   --> $DIR/disallowed-positions.rs:106:23
846    |
847 LL |         while let 0 = 0? {}
848    |                       ^^ the `?` operator cannot be applied to type `{integer}`
849    |
850    = help: the trait `Try` is not implemented for `{integer}`
851    = note: required by `branch`
852
853 error[E0614]: type `bool` cannot be dereferenced
854   --> $DIR/disallowed-positions.rs:173:5
855    |
856 LL |     *let 0 = 0;
857    |     ^^^^^^^^^^
858
859 error[E0600]: cannot apply unary operator `-` to type `bool`
860   --> $DIR/disallowed-positions.rs:175:5
861    |
862 LL |     -let 0 = 0;
863    |     ^^^^^^^^^^ cannot apply unary operator `-`
864
865 error[E0277]: the `?` operator can only be applied to values that implement `Try`
866   --> $DIR/disallowed-positions.rs:183:5
867    |
868 LL |     (let 0 = 0)?;
869    |     ^^^^^^^^^^^^ the `?` operator cannot be applied to type `bool`
870    |
871    = help: the trait `Try` is not implemented for `bool`
872    = note: required by `branch`
873
874 error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `FromResidual`)
875   --> $DIR/disallowed-positions.rs:183:16
876    |
877 LL | / fn outside_if_and_while_expr() {
878 LL | |     &let 0 = 0;
879 LL | |
880 LL | |     !let 0 = 0;
881 ...  |
882 LL | |     (let 0 = 0)?;
883    | |                ^ cannot use the `?` operator in a function that returns `()`
884 ...  |
885 LL | |
886 LL | | }
887    | |_- this function should return `Result` or `Option` to accept `?`
888    |
889    = help: the trait `FromResidual<_>` is not implemented for `()`
890    = note: required by `from_residual`
891
892 error[E0308]: mismatched types
893   --> $DIR/disallowed-positions.rs:198:10
894    |
895 LL |     (let Range { start: _, end: _ } = true..true || false);
896    |          ^^^^^^^^^^^^^^^^^^^^^^^^^^   ---- this expression has type `bool`
897    |          |
898    |          expected `bool`, found struct `std::ops::Range`
899    |
900    = note: expected type `bool`
901             found struct `std::ops::Range<_>`
902
903 error[E0308]: mismatched types
904   --> $DIR/disallowed-positions.rs:207:5
905    |
906 LL | fn outside_if_and_while_expr() {
907    |                                - help: try adding a return type: `-> &bool`
908 ...
909 LL |     &let 0 = 0
910    |     ^^^^^^^^^^ expected `()`, found `&bool`
911
912 error[E0277]: the `?` operator can only be applied to values that implement `Try`
913   --> $DIR/disallowed-positions.rs:179:17
914    |
915 LL |         let 0 = 0?;
916    |                 ^^ the `?` operator cannot be applied to type `{integer}`
917    |
918    = help: the trait `Try` is not implemented for `{integer}`
919    = note: required by `branch`
920
921 error: aborting due to 104 previous errors; 2 warnings emitted
922
923 Some errors have detailed explanations: E0277, E0308, E0600, E0614.
924 For more information about an error, try `rustc --explain E0277`.