1 error: expressions must be enclosed in braces to be used as const generic arguments
2 --> $DIR/disallowed-positions.rs:236:9
7 help: enclose the `const` expression in braces
9 LL | { true && let 1 = 1 }
12 error: `let` expressions are not supported here
13 --> $DIR/disallowed-positions.rs:32:9
18 = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
20 error: `let` expressions are not supported here
21 --> $DIR/disallowed-positions.rs:35:9
26 = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
28 error: `let` expressions are not supported here
29 --> $DIR/disallowed-positions.rs:36:9
34 = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
36 error: `let` expressions are not supported here
37 --> $DIR/disallowed-positions.rs:38:9
42 = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
44 error: `let` expressions are not supported here
45 --> $DIR/disallowed-positions.rs:46:9
47 LL | if (let 0 = 0)? {}
50 = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
52 error: `let` expressions are not supported here
53 --> $DIR/disallowed-positions.rs:50:16
55 LL | if true || let 0 = 0 {}
58 = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
60 error: `let` expressions are not supported here
61 --> $DIR/disallowed-positions.rs:51:17
63 LL | if (true || let 0 = 0) {}
66 = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
68 error: `let` expressions are not supported here
69 --> $DIR/disallowed-positions.rs:52:25
71 LL | if true && (true || let 0 = 0) {}
74 = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
76 error: `let` expressions are not supported here
77 --> $DIR/disallowed-positions.rs:53:25
79 LL | if true || (true && let 0 = 0) {}
82 = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
84 error: `let` expressions are not supported here
85 --> $DIR/disallowed-positions.rs:56:12
87 LL | if x = let 0 = 0 {}
90 = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
92 error: `let` expressions are not supported here
93 --> $DIR/disallowed-positions.rs:59:15
95 LL | if true..(let 0 = 0) {}
98 = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
100 error: `let` expressions are not supported here
101 --> $DIR/disallowed-positions.rs:61:11
103 LL | if ..(let 0 = 0) {}
106 = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
108 error: `let` expressions are not supported here
109 --> $DIR/disallowed-positions.rs:63:9
111 LL | if (let 0 = 0).. {}
114 = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
116 error: `let` expressions are not supported here
117 --> $DIR/disallowed-positions.rs:67:8
119 LL | if let Range { start: _, end: _ } = true..true && false {}
120 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
122 = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
124 error: `let` expressions are not supported here
125 --> $DIR/disallowed-positions.rs:71:8
127 LL | if let Range { start: _, end: _ } = true..true || false {}
128 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
130 = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
132 error: `let` expressions are not supported here
133 --> $DIR/disallowed-positions.rs:78:8
135 LL | if let Range { start: F, end } = F..|| true {}
136 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
138 = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
140 error: `let` expressions are not supported here
141 --> $DIR/disallowed-positions.rs:86:8
143 LL | if let Range { start: true, end } = t..&&false {}
144 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
146 = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
148 error: `let` expressions are not supported here
149 --> $DIR/disallowed-positions.rs:92:19
151 LL | if let true = let true = true {}
154 = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
156 error: `let` expressions are not supported here
157 --> $DIR/disallowed-positions.rs:96:12
159 LL | while &let 0 = 0 {}
162 = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
164 error: `let` expressions are not supported here
165 --> $DIR/disallowed-positions.rs:99:12
167 LL | while !let 0 = 0 {}
170 = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
172 error: `let` expressions are not supported here
173 --> $DIR/disallowed-positions.rs:100:12
175 LL | while *let 0 = 0 {}
178 = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
180 error: `let` expressions are not supported here
181 --> $DIR/disallowed-positions.rs:102:12
183 LL | while -let 0 = 0 {}
186 = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
188 error: `let` expressions are not supported here
189 --> $DIR/disallowed-positions.rs:110:12
191 LL | while (let 0 = 0)? {}
194 = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
196 error: `let` expressions are not supported here
197 --> $DIR/disallowed-positions.rs:114:19
199 LL | while true || let 0 = 0 {}
202 = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
204 error: `let` expressions are not supported here
205 --> $DIR/disallowed-positions.rs:115:20
207 LL | while (true || let 0 = 0) {}
210 = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
212 error: `let` expressions are not supported here
213 --> $DIR/disallowed-positions.rs:116:28
215 LL | while true && (true || let 0 = 0) {}
218 = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
220 error: `let` expressions are not supported here
221 --> $DIR/disallowed-positions.rs:117:28
223 LL | while true || (true && let 0 = 0) {}
226 = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
228 error: `let` expressions are not supported here
229 --> $DIR/disallowed-positions.rs:120:15
231 LL | while x = let 0 = 0 {}
234 = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
236 error: `let` expressions are not supported here
237 --> $DIR/disallowed-positions.rs:123:18
239 LL | while true..(let 0 = 0) {}
242 = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
244 error: `let` expressions are not supported here
245 --> $DIR/disallowed-positions.rs:125:14
247 LL | while ..(let 0 = 0) {}
250 = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
252 error: `let` expressions are not supported here
253 --> $DIR/disallowed-positions.rs:127:12
255 LL | while (let 0 = 0).. {}
258 = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
260 error: `let` expressions are not supported here
261 --> $DIR/disallowed-positions.rs:131:11
263 LL | while let Range { start: _, end: _ } = true..true && false {}
264 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
266 = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
268 error: `let` expressions are not supported here
269 --> $DIR/disallowed-positions.rs:135:11
271 LL | while let Range { start: _, end: _ } = true..true || false {}
272 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
274 = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
276 error: `let` expressions are not supported here
277 --> $DIR/disallowed-positions.rs:142:11
279 LL | while let Range { start: F, end } = F..|| true {}
280 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
282 = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
284 error: `let` expressions are not supported here
285 --> $DIR/disallowed-positions.rs:150:11
287 LL | while let Range { start: true, end } = t..&&false {}
288 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
290 = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
292 error: `let` expressions are not supported here
293 --> $DIR/disallowed-positions.rs:156:22
295 LL | while let true = let true = true {}
298 = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
300 error: `let` expressions are not supported here
301 --> $DIR/disallowed-positions.rs:170:6
306 = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
308 error: `let` expressions are not supported here
309 --> $DIR/disallowed-positions.rs:172:6
314 = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
316 error: `let` expressions are not supported here
317 --> $DIR/disallowed-positions.rs:173:6
322 = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
324 error: `let` expressions are not supported here
325 --> $DIR/disallowed-positions.rs:175:6
330 = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
332 error: `let` expressions are not supported here
333 --> $DIR/disallowed-positions.rs:183:6
338 = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
340 error: `let` expressions are not supported here
341 --> $DIR/disallowed-positions.rs:187:13
343 LL | true || let 0 = 0;
346 = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
348 error: `let` expressions are not supported here
349 --> $DIR/disallowed-positions.rs:188:14
351 LL | (true || let 0 = 0);
354 = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
356 error: `let` expressions are not supported here
357 --> $DIR/disallowed-positions.rs:189:22
359 LL | true && (true || let 0 = 0);
362 = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
364 error: `let` expressions are not supported here
365 --> $DIR/disallowed-positions.rs:192:9
370 = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
372 error: `let` expressions are not supported here
373 --> $DIR/disallowed-positions.rs:194:12
375 LL | true..(let 0 = 0);
378 = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
380 error: `let` expressions are not supported here
381 --> $DIR/disallowed-positions.rs:195:8
386 = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
388 error: `let` expressions are not supported here
389 --> $DIR/disallowed-positions.rs:196:6
394 = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
396 error: `let` expressions are not supported here
397 --> $DIR/disallowed-positions.rs:198:6
399 LL | (let Range { start: _, end: _ } = true..true || false);
400 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
402 = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
404 error: `let` expressions are not supported here
405 --> $DIR/disallowed-positions.rs:202:6
407 LL | (let true = let true = true);
408 | ^^^^^^^^^^^^^^^^^^^^^^^^^^
410 = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
412 error: `let` expressions are not supported here
413 --> $DIR/disallowed-positions.rs:202:17
415 LL | (let true = let true = true);
418 = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
420 error: `let` expressions are not supported here
421 --> $DIR/disallowed-positions.rs:207:6
426 = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
428 error: `let` expressions are not supported here
429 --> $DIR/disallowed-positions.rs:218:17
431 LL | true && let 1 = 1
434 = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
436 error: `let` expressions are not supported here
437 --> $DIR/disallowed-positions.rs:222:17
439 LL | true && let 1 = 1
442 = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
444 error: `let` expressions are not supported here
445 --> $DIR/disallowed-positions.rs:226:17
447 LL | true && let 1 = 1
450 = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
452 error: `let` expressions are not supported here
453 --> $DIR/disallowed-positions.rs:236:17
455 LL | true && let 1 = 1
458 = note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
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
463 LL | #![feature(const_generics)]
466 = note: `#[warn(incomplete_features)]` on by default
467 = note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
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
472 LL | #![feature(let_chains)] // Avoid inflating `.stderr` with overzealous gates in this test.
475 = note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information
477 error[E0308]: mismatched types
478 --> $DIR/disallowed-positions.rs:32:8
480 LL | if &let 0 = 0 {}
481 | ^^^^^^^^^^ expected `bool`, found `&bool`
483 help: consider removing the borrow
488 error[E0614]: type `bool` cannot be dereferenced
489 --> $DIR/disallowed-positions.rs:36:8
491 LL | if *let 0 = 0 {}
494 error[E0600]: cannot apply unary operator `-` to type `bool`
495 --> $DIR/disallowed-positions.rs:38:8
497 LL | if -let 0 = 0 {}
498 | ^^^^^^^^^^ cannot apply unary operator `-`
500 error[E0277]: the `?` operator can only be applied to values that implement `Try`
501 --> $DIR/disallowed-positions.rs:46:8
503 LL | if (let 0 = 0)? {}
504 | ^^^^^^^^^^^^ the `?` operator cannot be applied to type `bool`
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
510 LL | fn branch(self) -> ControlFlow<Self::Residual, Self::Output>;
511 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
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
516 LL | / fn nested_within_if_expr() {
517 LL | | if &let 0 = 0 {}
521 LL | | if (let 0 = 0)? {}
522 | | ^ cannot use the `?` operator in a function that returns `()`
524 LL | | if let true = let true = true {}
526 | |_- this function should return `Result` or `Option` to accept `?`
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
532 LL | fn from_residual(residual: R) -> Self;
533 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
535 error[E0308]: mismatched types
536 --> $DIR/disallowed-positions.rs:56:8
538 LL | if x = let 0 = 0 {}
539 | ^^^^^^^^^^^^^ expected `bool`, found `()`
541 help: you might have meant to compare for equality
543 LL | if x == let 0 = 0 {}
546 error[E0308]: mismatched types
547 --> $DIR/disallowed-positions.rs:59:8
549 LL | if true..(let 0 = 0) {}
550 | ^^^^^^^^^^^^^^^^^ expected `bool`, found struct `std::ops::Range`
552 = note: expected type `bool`
553 found struct `std::ops::Range<bool>`
555 error[E0308]: mismatched types
556 --> $DIR/disallowed-positions.rs:61:8
558 LL | if ..(let 0 = 0) {}
559 | ^^^^^^^^^^^^^ expected `bool`, found struct `RangeTo`
561 = note: expected type `bool`
562 found struct `RangeTo<bool>`
564 error[E0308]: mismatched types
565 --> $DIR/disallowed-positions.rs:63:8
567 LL | if (let 0 = 0).. {}
568 | ^^^^^^^^^^^^^ expected `bool`, found struct `RangeFrom`
570 = note: expected type `bool`
571 found struct `RangeFrom<bool>`
573 error[E0308]: mismatched types
574 --> $DIR/disallowed-positions.rs:67:12
576 LL | if let Range { start: _, end: _ } = true..true && false {}
577 | ^^^^^^^^^^^^^^^^^^^^^^^^^^ ---- this expression has type `bool`
579 | expected `bool`, found struct `std::ops::Range`
581 = note: expected type `bool`
582 found struct `std::ops::Range<_>`
584 error[E0308]: mismatched types
585 --> $DIR/disallowed-positions.rs:67:8
587 LL | if let Range { start: _, end: _ } = true..true && false {}
588 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found struct `std::ops::Range`
590 = note: expected type `bool`
591 found struct `std::ops::Range<bool>`
593 error[E0308]: mismatched types
594 --> $DIR/disallowed-positions.rs:71:12
596 LL | if let Range { start: _, end: _ } = true..true || false {}
597 | ^^^^^^^^^^^^^^^^^^^^^^^^^^ ---- this expression has type `bool`
599 | expected `bool`, found struct `std::ops::Range`
601 = note: expected type `bool`
602 found struct `std::ops::Range<_>`
604 error[E0308]: mismatched types
605 --> $DIR/disallowed-positions.rs:71:8
607 LL | if let Range { start: _, end: _ } = true..true || false {}
608 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found struct `std::ops::Range`
610 = note: expected type `bool`
611 found struct `std::ops::Range<bool>`
613 error[E0308]: mismatched types
614 --> $DIR/disallowed-positions.rs:78:12
616 LL | if let Range { start: F, end } = F..|| true {}
617 | ^^^^^^^^^^^^^^^^^^^^^^^ expected fn pointer, found struct `std::ops::Range`
619 = note: expected fn pointer `fn() -> bool`
620 found struct `std::ops::Range<_>`
622 error[E0308]: mismatched types
623 --> $DIR/disallowed-positions.rs:78:41
625 LL | if let Range { start: F, end } = F..|| true {}
626 | ^^^^^^^ expected `bool`, found closure
628 = note: expected type `bool`
629 found closure `[closure@$DIR/disallowed-positions.rs:78:41: 78:48]`
631 error[E0308]: mismatched types
632 --> $DIR/disallowed-positions.rs:78:8
634 LL | if let Range { start: F, end } = F..|| true {}
635 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found struct `std::ops::Range`
637 = note: expected type `bool`
638 found struct `std::ops::Range<bool>`
640 error[E0308]: mismatched types
641 --> $DIR/disallowed-positions.rs:86:12
643 LL | if let Range { start: true, end } = t..&&false {}
644 | ^^^^^^^^^^^^^^^^^^^^^^^^^^ - this expression has type `&&bool`
646 | expected `bool`, found struct `std::ops::Range`
648 = note: expected type `bool`
649 found struct `std::ops::Range<_>`
651 error[E0308]: mismatched types
652 --> $DIR/disallowed-positions.rs:86:44
654 LL | if let Range { start: true, end } = t..&&false {}
655 | ^^^^^^^ expected `bool`, found `&&bool`
657 error[E0308]: mismatched types
658 --> $DIR/disallowed-positions.rs:86:8
660 LL | if let Range { start: true, end } = t..&&false {}
661 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found struct `std::ops::Range`
663 = note: expected type `bool`
664 found struct `std::ops::Range<bool>`
666 error[E0277]: the `?` operator can only be applied to values that implement `Try`
667 --> $DIR/disallowed-positions.rs:42:20
669 LL | if let 0 = 0? {}
670 | ^^ the `?` operator cannot be applied to type `{integer}`
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
676 LL | fn branch(self) -> ControlFlow<Self::Residual, Self::Output>;
677 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
679 error[E0308]: mismatched types
680 --> $DIR/disallowed-positions.rs:96:11
682 LL | while &let 0 = 0 {}
683 | ^^^^^^^^^^ expected `bool`, found `&bool`
685 help: consider removing the borrow
687 LL | while let 0 = 0 {}
690 error[E0614]: type `bool` cannot be dereferenced
691 --> $DIR/disallowed-positions.rs:100:11
693 LL | while *let 0 = 0 {}
696 error[E0600]: cannot apply unary operator `-` to type `bool`
697 --> $DIR/disallowed-positions.rs:102:11
699 LL | while -let 0 = 0 {}
700 | ^^^^^^^^^^ cannot apply unary operator `-`
702 error[E0277]: the `?` operator can only be applied to values that implement `Try`
703 --> $DIR/disallowed-positions.rs:110:11
705 LL | while (let 0 = 0)? {}
706 | ^^^^^^^^^^^^ the `?` operator cannot be applied to type `bool`
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
712 LL | fn branch(self) -> ControlFlow<Self::Residual, Self::Output>;
713 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
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
718 LL | / fn nested_within_while_expr() {
719 LL | | while &let 0 = 0 {}
723 LL | | while (let 0 = 0)? {}
724 | | ^ cannot use the `?` operator in a function that returns `()`
726 LL | | while let true = let true = true {}
728 | |_- this function should return `Result` or `Option` to accept `?`
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
734 LL | fn from_residual(residual: R) -> Self;
735 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
737 error[E0308]: mismatched types
738 --> $DIR/disallowed-positions.rs:120:11
740 LL | while x = let 0 = 0 {}
741 | ^^^^^^^^^^^^^ expected `bool`, found `()`
743 help: you might have meant to compare for equality
745 LL | while x == let 0 = 0 {}
748 error[E0308]: mismatched types
749 --> $DIR/disallowed-positions.rs:123:11
751 LL | while true..(let 0 = 0) {}
752 | ^^^^^^^^^^^^^^^^^ expected `bool`, found struct `std::ops::Range`
754 = note: expected type `bool`
755 found struct `std::ops::Range<bool>`
757 error[E0308]: mismatched types
758 --> $DIR/disallowed-positions.rs:125:11
760 LL | while ..(let 0 = 0) {}
761 | ^^^^^^^^^^^^^ expected `bool`, found struct `RangeTo`
763 = note: expected type `bool`
764 found struct `RangeTo<bool>`
766 error[E0308]: mismatched types
767 --> $DIR/disallowed-positions.rs:127:11
769 LL | while (let 0 = 0).. {}
770 | ^^^^^^^^^^^^^ expected `bool`, found struct `RangeFrom`
772 = note: expected type `bool`
773 found struct `RangeFrom<bool>`
775 error[E0308]: mismatched types
776 --> $DIR/disallowed-positions.rs:131:15
778 LL | while let Range { start: _, end: _ } = true..true && false {}
779 | ^^^^^^^^^^^^^^^^^^^^^^^^^^ ---- this expression has type `bool`
781 | expected `bool`, found struct `std::ops::Range`
783 = note: expected type `bool`
784 found struct `std::ops::Range<_>`
786 error[E0308]: mismatched types
787 --> $DIR/disallowed-positions.rs:131:11
789 LL | while let Range { start: _, end: _ } = true..true && false {}
790 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found struct `std::ops::Range`
792 = note: expected type `bool`
793 found struct `std::ops::Range<bool>`
795 error[E0308]: mismatched types
796 --> $DIR/disallowed-positions.rs:135:15
798 LL | while let Range { start: _, end: _ } = true..true || false {}
799 | ^^^^^^^^^^^^^^^^^^^^^^^^^^ ---- this expression has type `bool`
801 | expected `bool`, found struct `std::ops::Range`
803 = note: expected type `bool`
804 found struct `std::ops::Range<_>`
806 error[E0308]: mismatched types
807 --> $DIR/disallowed-positions.rs:135:11
809 LL | while let Range { start: _, end: _ } = true..true || false {}
810 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found struct `std::ops::Range`
812 = note: expected type `bool`
813 found struct `std::ops::Range<bool>`
815 error[E0308]: mismatched types
816 --> $DIR/disallowed-positions.rs:142:15
818 LL | while let Range { start: F, end } = F..|| true {}
819 | ^^^^^^^^^^^^^^^^^^^^^^^ expected fn pointer, found struct `std::ops::Range`
821 = note: expected fn pointer `fn() -> bool`
822 found struct `std::ops::Range<_>`
824 error[E0308]: mismatched types
825 --> $DIR/disallowed-positions.rs:142:44
827 LL | while let Range { start: F, end } = F..|| true {}
828 | ^^^^^^^ expected `bool`, found closure
830 = note: expected type `bool`
831 found closure `[closure@$DIR/disallowed-positions.rs:142:44: 142:51]`
833 error[E0308]: mismatched types
834 --> $DIR/disallowed-positions.rs:142:11
836 LL | while let Range { start: F, end } = F..|| true {}
837 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found struct `std::ops::Range`
839 = note: expected type `bool`
840 found struct `std::ops::Range<bool>`
842 error[E0308]: mismatched types
843 --> $DIR/disallowed-positions.rs:150:15
845 LL | while let Range { start: true, end } = t..&&false {}
846 | ^^^^^^^^^^^^^^^^^^^^^^^^^^ - this expression has type `&&bool`
848 | expected `bool`, found struct `std::ops::Range`
850 = note: expected type `bool`
851 found struct `std::ops::Range<_>`
853 error[E0308]: mismatched types
854 --> $DIR/disallowed-positions.rs:150:47
856 LL | while let Range { start: true, end } = t..&&false {}
857 | ^^^^^^^ expected `bool`, found `&&bool`
859 error[E0308]: mismatched types
860 --> $DIR/disallowed-positions.rs:150:11
862 LL | while let Range { start: true, end } = t..&&false {}
863 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found struct `std::ops::Range`
865 = note: expected type `bool`
866 found struct `std::ops::Range<bool>`
868 error[E0277]: the `?` operator can only be applied to values that implement `Try`
869 --> $DIR/disallowed-positions.rs:106:23
871 LL | while let 0 = 0? {}
872 | ^^ the `?` operator cannot be applied to type `{integer}`
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
878 LL | fn branch(self) -> ControlFlow<Self::Residual, Self::Output>;
879 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
881 error[E0614]: type `bool` cannot be dereferenced
882 --> $DIR/disallowed-positions.rs:173:5
887 error[E0600]: cannot apply unary operator `-` to type `bool`
888 --> $DIR/disallowed-positions.rs:175:5
891 | ^^^^^^^^^^ cannot apply unary operator `-`
893 error[E0277]: the `?` operator can only be applied to values that implement `Try`
894 --> $DIR/disallowed-positions.rs:183:5
897 | ^^^^^^^^^^^^ the `?` operator cannot be applied to type `bool`
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
903 LL | fn branch(self) -> ControlFlow<Self::Residual, Self::Output>;
904 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
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
909 LL | / fn outside_if_and_while_expr() {
915 | | ^ cannot use the `?` operator in a function that returns `()`
919 | |_- this function should return `Result` or `Option` to accept `?`
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
925 LL | fn from_residual(residual: R) -> Self;
926 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
928 error[E0308]: mismatched types
929 --> $DIR/disallowed-positions.rs:198:10
931 LL | (let Range { start: _, end: _ } = true..true || false);
932 | ^^^^^^^^^^^^^^^^^^^^^^^^^^ ---- this expression has type `bool`
934 | expected `bool`, found struct `std::ops::Range`
936 = note: expected type `bool`
937 found struct `std::ops::Range<_>`
939 error[E0308]: mismatched types
940 --> $DIR/disallowed-positions.rs:207:5
942 LL | fn outside_if_and_while_expr() {
943 | - help: try adding a return type: `-> &bool`
946 | ^^^^^^^^^^ expected `()`, found `&bool`
948 error[E0277]: the `?` operator can only be applied to values that implement `Try`
949 --> $DIR/disallowed-positions.rs:179:17
952 | ^^ the `?` operator cannot be applied to type `{integer}`
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
958 LL | fn branch(self) -> ControlFlow<Self::Residual, Self::Output>;
959 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
961 error: aborting due to 104 previous errors; 2 warnings emitted
963 Some errors have detailed explanations: E0277, E0308, E0600, E0614.
964 For more information about an error, try `rustc --explain E0277`.