]> git.lizzy.rs Git - rust.git/blob - src/test/ui/rfc-2497-if-let-chains/ensure-that-let-else-does-not-interact-with-let-chains.stderr
Rollup merge of #105758 - Nilstrieb:typeck-results-mod, r=compiler-errors
[rust.git] / src / test / ui / rfc-2497-if-let-chains / ensure-that-let-else-does-not-interact-with-let-chains.stderr
1 error: a `&&` expression cannot be directly assigned in `let...else`
2   --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:9:19
3    |
4 LL |     let Some(n) = opt && n == 1 else {
5    |                   ^^^^^^^^^^^^^
6    |
7 help: wrap the expression in parentheses
8    |
9 LL |     let Some(n) = (opt && n == 1) else {
10    |                   +             +
11
12 error: expected expression, found `let` statement
13   --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:15:26
14    |
15 LL |     let Some(n) = opt && let another = n else {
16    |                          ^^^
17
18 error: a `&&` expression cannot be directly assigned in `let...else`
19   --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:15:19
20    |
21 LL |     let Some(n) = opt && let another = n else {
22    |                   ^^^^^^^^^^^^^^^^^^^^^^
23    |
24 help: wrap the expression in parentheses
25    |
26 LL |     let Some(n) = (opt && let another = n) else {
27    |                   +                      +
28
29 error: this `if` expression is missing a block after the condition
30   --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:24:5
31    |
32 LL |     if let Some(n) = opt else {
33    |     ^^
34    |
35 help: add a block here
36   --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:24:25
37    |
38 LL |     if let Some(n) = opt else {
39    |                         ^
40
41 error: this `if` expression is missing a block after the condition
42   --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:28:5
43    |
44 LL |     if let Some(n) = opt && n == 1 else {
45    |     ^^
46    |
47 help: add a block here
48   --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:28:35
49    |
50 LL |     if let Some(n) = opt && n == 1 else {
51    |                                   ^
52
53 error: this `if` expression is missing a block after the condition
54   --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:32:5
55    |
56 LL |     if let Some(n) = opt && let another = n else {
57    |     ^^
58    |
59 help: add a block here
60   --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:32:44
61    |
62 LL |     if let Some(n) = opt && let another = n else {
63    |                                            ^
64
65 error: expected `{`, found keyword `else`
66   --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:38:33
67    |
68 LL |         while let Some(n) = opt else {
69    |         ----- ----------------- ^^^^ expected `{`
70    |         |     |
71    |         |     this `while` condition successfully parsed
72    |         while parsing the body of this `while` expression
73
74 error: expected `{`, found keyword `else`
75   --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:44:43
76    |
77 LL |         while let Some(n) = opt && n == 1 else {
78    |         ----- --------------------------- ^^^^ expected `{`
79    |         |     |
80    |         |     this `while` condition successfully parsed
81    |         while parsing the body of this `while` expression
82
83 error: expected `{`, found keyword `else`
84   --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:50:52
85    |
86 LL |         while let Some(n) = opt && let another = n else {
87    |         ----- ------------------------------------ ^^^^ expected `{`
88    |         |     |
89    |         |     this `while` condition successfully parsed
90    |         while parsing the body of this `while` expression
91
92 error: `let` expressions are not supported here
93   --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:15:26
94    |
95 LL |     let Some(n) = opt && let another = n else {
96    |                          ^^^^^^^^^^^^^^^
97    |
98    = note: only supported directly in conditions of `if` and `while` expressions
99
100 error[E0308]: mismatched types
101   --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:9:19
102    |
103 LL |     let Some(n) = opt && n == 1 else {
104    |                   ^^^ expected `bool`, found enum `Option`
105    |
106    = note: expected type `bool`
107               found enum `Option<i32>`
108
109 error[E0308]: mismatched types
110   --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:9:9
111    |
112 LL |     let Some(n) = opt && n == 1 else {
113    |         ^^^^^^^   ------------- this expression has type `bool`
114    |         |
115    |         expected `bool`, found enum `Option`
116    |
117    = note: expected type `bool`
118               found enum `Option<_>`
119
120 error[E0308]: mismatched types
121   --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:15:19
122    |
123 LL |     let Some(n) = opt && let another = n else {
124    |                   ^^^ expected `bool`, found enum `Option`
125    |
126    = note: expected type `bool`
127               found enum `Option<i32>`
128
129 error[E0308]: mismatched types
130   --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:15:9
131    |
132 LL |     let Some(n) = opt && let another = n else {
133    |         ^^^^^^^   ---------------------- this expression has type `bool`
134    |         |
135    |         expected `bool`, found enum `Option`
136    |
137    = note: expected type `bool`
138               found enum `Option<_>`
139
140 error: aborting due to 14 previous errors
141
142 For more information about this error, try `rustc --explain E0308`.