@@ -28,47 +28,61 @@ fn main() {}
28
28
fn _if ( ) {
29
29
if ( let 0 = 1 ) { }
30
30
//~^ ERROR `let` expressions are not supported here
31
+ //~| ERROR expected expression, found `let` statement
31
32
32
33
if ( ( ( let 0 = 1 ) ) ) { }
33
34
//~^ ERROR `let` expressions are not supported here
35
+ //~| ERROR expected expression, found `let` statement
34
36
35
37
if ( let 0 = 1 ) && true { }
36
38
//~^ ERROR `let` expressions are not supported here
39
+ //~| ERROR expected expression, found `let` statement
37
40
38
41
if true && ( let 0 = 1 ) { }
39
42
//~^ ERROR `let` expressions are not supported here
43
+ //~| ERROR expected expression, found `let` statement
40
44
41
45
if ( let 0 = 1 ) && ( let 0 = 1 ) { }
42
46
//~^ ERROR `let` expressions are not supported here
43
47
//~| ERROR `let` expressions are not supported here
48
+ //~| ERROR expected expression, found `let` statement
49
+ //~| ERROR expected expression, found `let` statement
44
50
45
51
if let 0 = 1 && let 1 = 2 && ( let 2 = 3 && let 3 = 4 && let 4 = 5 ) { }
46
52
//~^ ERROR `let` expressions are not supported here
47
53
//~| ERROR `let` expressions are not supported here
48
54
//~| ERROR `let` expressions are not supported here
55
+ //~| ERROR expected expression, found `let` statement
49
56
}
50
57
51
58
fn _while ( ) {
52
59
while ( let 0 = 1 ) { }
53
60
//~^ ERROR `let` expressions are not supported here
61
+ //~| ERROR expected expression, found `let` statement
54
62
55
63
while ( ( ( let 0 = 1 ) ) ) { }
56
64
//~^ ERROR `let` expressions are not supported here
65
+ //~| ERROR expected expression, found `let` statement
57
66
58
67
while ( let 0 = 1 ) && true { }
59
68
//~^ ERROR `let` expressions are not supported here
69
+ //~| ERROR expected expression, found `let` statement
60
70
61
71
while true && ( let 0 = 1 ) { }
62
72
//~^ ERROR `let` expressions are not supported here
73
+ //~| ERROR expected expression, found `let` statement
63
74
64
75
while ( let 0 = 1 ) && ( let 0 = 1 ) { }
65
76
//~^ ERROR `let` expressions are not supported here
66
77
//~| ERROR `let` expressions are not supported here
78
+ //~| ERROR expected expression, found `let` statement
79
+ //~| ERROR expected expression, found `let` statement
67
80
68
81
while let 0 = 1 && let 1 = 2 && ( let 2 = 3 && let 3 = 4 && let 4 = 5 ) { }
69
82
//~^ ERROR `let` expressions are not supported here
70
83
//~| ERROR `let` expressions are not supported here
71
84
//~| ERROR `let` expressions are not supported here
85
+ //~| ERROR expected expression, found `let` statement
72
86
}
73
87
74
88
fn _macros ( ) {
@@ -89,39 +103,64 @@ fn _macros() {
89
103
}
90
104
91
105
fn nested_within_if_expr ( ) {
92
- if & let 0 = 0 { } //~ ERROR `let` expressions are not supported here
93
- //~^ ERROR mismatched types
106
+ if & let 0 = 0 { }
107
+ //~^ ERROR `let` expressions are not supported here
108
+ //~| ERROR mismatched types
109
+ //~| ERROR expected expression, found `let` statement
94
110
95
- if !let 0 = 0 { } //~ ERROR `let` expressions are not supported here
96
- if * let 0 = 0 { } //~ ERROR `let` expressions are not supported here
97
- //~^ ERROR type `bool` cannot be dereferenced
98
- if -let 0 = 0 { } //~ ERROR `let` expressions are not supported here
99
- //~^ ERROR cannot apply unary operator `-` to type `bool`
111
+ if !let 0 = 0 { }
112
+ //~^ ERROR `let` expressions are not supported here
113
+ //~| ERROR expected expression, found `let` statement
114
+ if * let 0 = 0 { }
115
+ //~^ ERROR `let` expressions are not supported here
116
+ //~| ERROR type `bool` cannot be dereferenced
117
+ //~| ERROR expected expression, found `let` statement
118
+ if -let 0 = 0 { }
119
+ //~^ ERROR `let` expressions are not supported here
120
+ //~| ERROR cannot apply unary operator `-` to type `bool`
121
+ //~| ERROR expected expression, found `let` statement
100
122
101
123
fn _check_try_binds_tighter ( ) -> Result < ( ) , ( ) > {
102
124
if let 0 = 0 ? { }
103
125
//~^ ERROR the `?` operator can only be applied to values that implement `Try`
104
126
Ok ( ( ) )
105
127
}
106
- if ( let 0 = 0 ) ? { } //~ ERROR `let` expressions are not supported here
107
- //~^ ERROR the `?` operator can only be applied to values that implement `Try`
128
+ if ( let 0 = 0 ) ? { }
129
+ //~^ ERROR `let` expressions are not supported here
130
+ //~| ERROR the `?` operator can only be applied to values that implement `Try`
108
131
//~| ERROR the `?` operator can only be used in a function that returns `Result`
132
+ //~| ERROR expected expression, found `let` statement
109
133
110
- if true || let 0 = 0 { } //~ ERROR `let` expressions are not supported here
111
- if ( true || let 0 = 0 ) { } //~ ERROR `let` expressions are not supported here
112
- if true && ( true || let 0 = 0 ) { } //~ ERROR `let` expressions are not supported here
113
- if true || ( true && let 0 = 0 ) { } //~ ERROR `let` expressions are not supported here
134
+ if true || let 0 = 0 { }
135
+ //~^ ERROR `let` expressions are not supported here
136
+ //~| ERROR expected expression, found `let` statement
137
+ if ( true || let 0 = 0 ) { }
138
+ //~^ ERROR `let` expressions are not supported here
139
+ //~| ERROR expected expression, found `let` statement
140
+ if true && ( true || let 0 = 0 ) { }
141
+ //~^ ERROR `let` expressions are not supported here
142
+ //~| ERROR expected expression, found `let` statement
143
+ if true || ( true && let 0 = 0 ) { }
144
+ //~^ ERROR `let` expressions are not supported here
114
145
115
146
let mut x = true ;
116
- if x = let 0 = 0 { } //~ ERROR `let` expressions are not supported here
117
- //~^ ERROR mismatched types
147
+ if x = let 0 = 0 { }
148
+ //~^ ERROR `let` expressions are not supported here
149
+ //~| ERROR mismatched types
150
+ //~| ERROR expected expression, found `let` statement
118
151
119
- if true ..( let 0 = 0 ) { } //~ ERROR `let` expressions are not supported here
120
- //~^ ERROR mismatched types
121
- if ..( let 0 = 0 ) { } //~ ERROR `let` expressions are not supported here
122
- //~^ ERROR mismatched types
123
- if ( let 0 = 0 ) .. { } //~ ERROR `let` expressions are not supported here
124
- //~^ ERROR mismatched types
152
+ if true ..( let 0 = 0 ) { }
153
+ //~^ ERROR `let` expressions are not supported here
154
+ //~| ERROR mismatched types
155
+ //~| ERROR expected expression, found `let` statement
156
+ if ..( let 0 = 0 ) { }
157
+ //~^ ERROR `let` expressions are not supported here
158
+ //~| ERROR mismatched types
159
+ //~| ERROR expected expression, found `let` statement
160
+ if ( let 0 = 0 ) .. { }
161
+ //~^ ERROR `let` expressions are not supported here
162
+ //~| ERROR mismatched types
163
+ //~| ERROR expected expression, found `let` statement
125
164
126
165
// Binds as `(let ... = true)..true &&/|| false`.
127
166
if let Range { start : _, end : _ } = true ..true && false { }
@@ -151,42 +190,68 @@ fn nested_within_if_expr() {
151
190
152
191
if let true = let true = true { }
153
192
//~^ ERROR `let` expressions are not supported here
193
+ //~| ERROR expected expression, found `let` statement
154
194
}
155
195
156
196
fn nested_within_while_expr ( ) {
157
- while & let 0 = 0 { } //~ ERROR `let` expressions are not supported here
158
- //~^ ERROR mismatched types
197
+ while & let 0 = 0 { }
198
+ //~^ ERROR `let` expressions are not supported here
199
+ //~| ERROR mismatched types
200
+ //~| ERROR expected expression, found `let` statement
159
201
160
- while !let 0 = 0 { } //~ ERROR `let` expressions are not supported here
161
- while * let 0 = 0 { } //~ ERROR `let` expressions are not supported here
162
- //~^ ERROR type `bool` cannot be dereferenced
163
- while -let 0 = 0 { } //~ ERROR `let` expressions are not supported here
164
- //~^ ERROR cannot apply unary operator `-` to type `bool`
202
+ while !let 0 = 0 { }
203
+ //~^ ERROR `let` expressions are not supported here
204
+ //~| ERROR expected expression, found `let` statement
205
+ while * let 0 = 0 { }
206
+ //~^ ERROR `let` expressions are not supported here
207
+ //~| ERROR type `bool` cannot be dereferenced
208
+ //~| ERROR expected expression, found `let` statement
209
+ while -let 0 = 0 { }
210
+ //~^ ERROR `let` expressions are not supported here
211
+ //~| ERROR cannot apply unary operator `-` to type `bool`
212
+ //~| ERROR expected expression, found `let` statement
165
213
166
214
fn _check_try_binds_tighter ( ) -> Result < ( ) , ( ) > {
167
215
while let 0 = 0 ? { }
168
216
//~^ ERROR the `?` operator can only be applied to values that implement `Try`
169
217
Ok ( ( ) )
170
218
}
171
- while ( let 0 = 0 ) ? { } //~ ERROR `let` expressions are not supported here
172
- //~^ ERROR the `?` operator can only be applied to values that implement `Try`
219
+ while ( let 0 = 0 ) ? { }
220
+ //~^ ERROR `let` expressions are not supported here
221
+ //~| ERROR the `?` operator can only be applied to values that implement `Try`
173
222
//~| ERROR the `?` operator can only be used in a function that returns `Result`
223
+ //~| ERROR expected expression, found `let` statement
174
224
175
- while true || let 0 = 0 { } //~ ERROR `let` expressions are not supported here
176
- while ( true || let 0 = 0 ) { } //~ ERROR `let` expressions are not supported here
177
- while true && ( true || let 0 = 0 ) { } //~ ERROR `let` expressions are not supported here
178
- while true || ( true && let 0 = 0 ) { } //~ ERROR `let` expressions are not supported here
225
+ while true || let 0 = 0 { }
226
+ //~^ ERROR `let` expressions are not supported here
227
+ //~| ERROR expected expression, found `let` statement
228
+ while ( true || let 0 = 0 ) { }
229
+ //~^ ERROR `let` expressions are not supported here
230
+ //~| ERROR expected expression, found `let` statement
231
+ while true && ( true || let 0 = 0 ) { }
232
+ //~^ ERROR `let` expressions are not supported here
233
+ //~| ERROR expected expression, found `let` statement
234
+ while true || ( true && let 0 = 0 ) { }
235
+ //~^ ERROR `let` expressions are not supported here
179
236
180
237
let mut x = true ;
181
- while x = let 0 = 0 { } //~ ERROR `let` expressions are not supported here
182
- //~^ ERROR mismatched types
238
+ while x = let 0 = 0 { }
239
+ //~^ ERROR `let` expressions are not supported here
240
+ //~| ERROR mismatched types
241
+ //~| ERROR expected expression, found `let` statement
183
242
184
- while true ..( let 0 = 0 ) { } //~ ERROR `let` expressions are not supported here
185
- //~^ ERROR mismatched types
186
- while ..( let 0 = 0 ) { } //~ ERROR `let` expressions are not supported here
187
- //~^ ERROR mismatched types
188
- while ( let 0 = 0 ) .. { } //~ ERROR `let` expressions are not supported here
189
- //~^ ERROR mismatched types
243
+ while true ..( let 0 = 0 ) { }
244
+ //~^ ERROR `let` expressions are not supported here
245
+ //~| ERROR mismatched types
246
+ //~| ERROR expected expression, found `let` statement
247
+ while ..( let 0 = 0 ) { }
248
+ //~^ ERROR `let` expressions are not supported here
249
+ //~| ERROR mismatched types
250
+ //~| ERROR expected expression, found `let` statement
251
+ while ( let 0 = 0 ) .. { }
252
+ //~^ ERROR `let` expressions are not supported here
253
+ //~| ERROR mismatched types
254
+ //~| ERROR expected expression, found `let` statement
190
255
191
256
// Binds as `(let ... = true)..true &&/|| false`.
192
257
while let Range { start : _, end : _ } = true ..true && false { }
@@ -216,6 +281,7 @@ fn nested_within_while_expr() {
216
281
217
282
while let true = let true = true { }
218
283
//~^ ERROR `let` expressions are not supported here
284
+ //~| ERROR expected expression, found `let` statement
219
285
}
220
286
221
287
fn not_error_because_clarified_intent ( ) {
@@ -316,15 +382,18 @@ fn inside_const_generic_arguments() {
316
382
impl < const B : bool > A < { B } > { const O : u32 = 5 ; }
317
383
318
384
if let A :: < {
319
- true && let 1 = 1 //~ ERROR `let` expressions are not supported here
385
+ true && let 1 = 1
386
+ //~^ ERROR `let` expressions are not supported here
320
387
} > :: O = 5 { }
321
388
322
389
while let A :: < {
323
- true && let 1 = 1 //~ ERROR `let` expressions are not supported here
390
+ true && let 1 = 1
391
+ //~^ ERROR `let` expressions are not supported here
324
392
} > :: O = 5 { }
325
393
326
394
if A :: < {
327
- true && let 1 = 1 //~ ERROR `let` expressions are not supported here
395
+ true && let 1 = 1
396
+ //~^ ERROR `let` expressions are not supported here
328
397
} > :: O == 5 { }
329
398
330
399
// In the cases above we have `ExprKind::Block` to help us out.
@@ -345,28 +414,37 @@ fn with_parenthesis() {
345
414
346
415
if ( let Some ( a) = opt && true ) {
347
416
//~^ ERROR `let` expressions are not supported here
417
+ //~| ERROR expected expression, found `let` statement
348
418
}
349
419
350
420
if ( let Some ( a) = opt) && true {
351
421
//~^ ERROR `let` expressions are not supported here
422
+ //~| ERROR expected expression, found `let` statement
352
423
}
353
424
if ( let Some ( a) = opt) && ( let Some ( b) = a) {
354
425
//~^ ERROR `let` expressions are not supported here
355
426
//~| ERROR `let` expressions are not supported here
427
+ //~| ERROR expected expression, found `let` statement
428
+ //~| ERROR expected expression, found `let` statement
356
429
}
357
430
if let Some ( a) = opt && ( true && true ) {
358
431
}
359
432
360
433
if ( let Some ( a) = opt && ( let Some ( b) = a) ) && b == 1 {
361
434
//~^ ERROR `let` expressions are not supported here
362
435
//~| ERROR `let` expressions are not supported here
436
+ //~| ERROR expected expression, found `let` statement
437
+ //~| ERROR expected expression, found `let` statement
363
438
}
364
439
if ( let Some ( a) = opt && ( let Some ( b) = a) ) && true {
365
440
//~^ ERROR `let` expressions are not supported here
366
441
//~| ERROR `let` expressions are not supported here
442
+ //~| ERROR expected expression, found `let` statement
443
+ //~| ERROR expected expression, found `let` statement
367
444
}
368
445
if ( let Some ( a) = opt && ( true ) ) && true {
369
446
//~^ ERROR `let` expressions are not supported here
447
+ //~| ERROR expected expression, found `let` statement
370
448
}
371
449
372
450
if ( true && ( true ) ) && let Some ( a) = opt {
0 commit comments