@@ -81,9 +81,11 @@ fn _macros() {
8181 use_expr ! ( ( let 0 = 1 && 0 == 0 ) ) ;
8282 //~^ ERROR `let` expressions are not supported here
8383 //~| ERROR `let` expressions are not supported here
84+ //~| ERROR expected expression, found `let` statement
8485 use_expr ! ( ( let 0 = 1 ) ) ;
8586 //~^ ERROR `let` expressions are not supported here
8687 //~| ERROR `let` expressions are not supported here
88+ //~| ERROR expected expression, found `let` statement
8789}
8890
8991fn nested_within_if_expr ( ) {
@@ -147,7 +149,8 @@ fn nested_within_if_expr() {
147149 //~| ERROR mismatched types
148150 //~| ERROR mismatched types
149151
150- if let true = let true = true { } //~ ERROR `let` expressions are not supported here
152+ if let true = let true = true { }
153+ //~^ ERROR `let` expressions are not supported here
151154}
152155
153156fn nested_within_while_expr ( ) {
@@ -211,7 +214,8 @@ fn nested_within_while_expr() {
211214 //~| ERROR mismatched types
212215 //~| ERROR mismatched types
213216
214- while let true = let true = true { } //~ ERROR `let` expressions are not supported here
217+ while let true = let true = true { }
218+ //~^ ERROR `let` expressions are not supported here
215219}
216220
217221fn not_error_because_clarified_intent ( ) {
@@ -225,45 +229,85 @@ fn not_error_because_clarified_intent() {
225229}
226230
227231fn outside_if_and_while_expr ( ) {
228- & let 0 = 0 ; //~ ERROR `let` expressions are not supported here
232+ & let 0 = 0 ;
233+ //~^ ERROR `let` expressions are not supported here
234+ //~| ERROR expected expression, found `let` statement
229235
230- !let 0 = 0 ; //~ ERROR `let` expressions are not supported here
231- * let 0 = 0 ; //~ ERROR `let` expressions are not supported here
232- //~^ ERROR type `bool` cannot be dereferenced
233- -let 0 = 0 ; //~ ERROR `let` expressions are not supported here
234- //~^ ERROR cannot apply unary operator `-` to type `bool`
236+ !let 0 = 0 ;
237+ //~^ ERROR `let` expressions are not supported here
238+ //~| ERROR expected expression, found `let` statement
239+ * let 0 = 0 ;
240+ //~^ ERROR `let` expressions are not supported here
241+ //~| ERROR type `bool` cannot be dereferenced
242+ //~| ERROR expected expression, found `let` statement
243+ -let 0 = 0 ;
244+ //~^ ERROR `let` expressions are not supported here
245+ //~| ERROR cannot apply unary operator `-` to type `bool`
246+ //~| ERROR expected expression, found `let` statement
235247
236248 fn _check_try_binds_tighter ( ) -> Result < ( ) , ( ) > {
237249 let 0 = 0 ?;
238250 //~^ ERROR the `?` operator can only be applied to values that implement `Try`
239251 Ok ( ( ) )
240252 }
241- ( let 0 = 0 ) ?; //~ ERROR `let` expressions are not supported here
242- //~^ ERROR the `?` operator can only be used in a function that returns `Result`
253+ ( let 0 = 0 ) ?;
254+ //~^ ERROR `let` expressions are not supported here
255+ //~| ERROR the `?` operator can only be used in a function that returns `Result`
243256 //~| ERROR the `?` operator can only be applied to values that implement `Try`
257+ //~| ERROR expected expression, found `let` statement
244258
245- true || let 0 = 0 ; //~ ERROR `let` expressions are not supported here
246- ( true || let 0 = 0 ) ; //~ ERROR `let` expressions are not supported here
247- true && ( true || let 0 = 0 ) ; //~ ERROR `let` expressions are not supported here
259+ true || let 0 = 0 ;
260+ //~^ ERROR `let` expressions are not supported here
261+ //~| ERROR expected expression, found `let` statement
262+ ( true || let 0 = 0 ) ;
263+ //~^ ERROR `let` expressions are not supported here
264+ //~| ERROR expected expression, found `let` statement
265+ true && ( true || let 0 = 0 ) ;
266+ //~^ ERROR `let` expressions are not supported here
267+ //~| ERROR expected expression, found `let` statement
248268
249269 let mut x = true ;
250- x = let 0 = 0 ; //~ ERROR `let` expressions are not supported here
270+ x = let 0 = 0 ;
271+ //~^ ERROR `let` expressions are not supported here
272+ //~| ERROR expected expression, found `let` statement
251273
252- true ..( let 0 = 0 ) ; //~ ERROR `let` expressions are not supported here
253- ..( let 0 = 0 ) ; //~ ERROR `let` expressions are not supported here
254- ( let 0 = 0 ) ..; //~ ERROR `let` expressions are not supported here
274+ true ..( let 0 = 0 ) ;
275+ //~^ ERROR `let` expressions are not supported here
276+ //~| ERROR expected expression, found `let` statement
277+ ..( let 0 = 0 ) ;
278+ //~^ ERROR `let` expressions are not supported here
279+ //~| ERROR expected expression, found `let` statement
280+ ( let 0 = 0 ) ..;
281+ //~^ ERROR `let` expressions are not supported here
282+ //~| ERROR expected expression, found `let` statement
255283
256284 ( let Range { start : _, end : _ } = true ..true || false ) ;
257285 //~^ ERROR `let` expressions are not supported here
258286 //~| ERROR mismatched types
287+ //~| ERROR expected expression, found `let` statement
259288
260289 ( let true = let true = true ) ;
261290 //~^ ERROR `let` expressions are not supported here
291+ //~| ERROR expected expression, found `let` statement
292+ //~| ERROR expected expression, found `let` statement
293+
294+ {
295+ #[ cfg( FALSE ) ]
296+ let x = true && let y = 1 ;
297+ //~^ ERROR expected expression, found `let` statement
298+ }
299+
300+ #[ cfg( FALSE ) ]
301+ {
302+ [ 1 , 2 , 3 ] [ let _ = ( ) ]
303+ //~^ ERROR expected expression, found `let` statement
304+ }
262305
263306 // Check function tail position.
264307 & let 0 = 0
265308 //~^ ERROR `let` expressions are not supported here
266309 //~| ERROR mismatched types
310+ //~| ERROR expected expression, found `let` statement
267311}
268312
269313// Let's make sure that `let` inside const generic arguments are considered.
@@ -335,4 +379,14 @@ fn with_parenthesis() {
335379 let fun = || true ;
336380 if let true = ( true && fun ( ) ) && ( true ) {
337381 }
382+
383+ #[ cfg( FALSE ) ]
384+ let x = ( true && let y = 1 ) ;
385+ //~^ ERROR expected expression, found `let` statement
386+
387+ #[ cfg( FALSE ) ]
388+ {
389+ ( [ 1 , 2 , 3 ] [ let _ = ( ) ] )
390+ //~^ ERROR expected expression, found `let` statement
391+ }
338392}
0 commit comments