File tree 2 files changed +4
-3
lines changed
2 files changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -2221,8 +2221,9 @@ impl<'a> Parser<'a> {
2221
2221
} else if self . token . is_keyword ( keywords:: Let ) {
2222
2222
// Catch this syntax error here, instead of in `check_strict_keywords`, so
2223
2223
// that we can explicitly mention that let is not to be used as an expression
2224
- let msg = "`let` is not an expression, so it cannot be used in this way" ;
2225
- return Err ( self . fatal ( & msg) ) ;
2224
+ let mut db = self . fatal ( "expected expression, found statement (`let`)" ) ;
2225
+ db. note ( "variable declaration using `let` is a statement" ) ;
2226
+ return Err ( db) ;
2226
2227
} else if self . check ( & token:: ModSep ) ||
2227
2228
self . token . is_ident ( ) &&
2228
2229
!self . check_keyword ( keywords:: True ) &&
Original file line number Diff line number Diff line change 10
10
11
11
// ignore-cross-compile
12
12
13
- // error-pattern:`let` is not an expression, so it cannot be used in this way
13
+ // error-pattern:expected expression, found statement (`let`)
14
14
15
15
#![ feature( quote, rustc_private) ]
16
16
You can’t perform that action at this time.
0 commit comments