File tree Expand file tree Collapse file tree 2 files changed +4
-3
lines changed Expand file tree Collapse file tree 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> {
22212221 } else if self . token . is_keyword ( keywords:: Let ) {
22222222 // Catch this syntax error here, instead of in `check_strict_keywords`, so
22232223 // 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) ;
22262227 } else if self . check ( & token:: ModSep ) ||
22272228 self . token . is_ident ( ) &&
22282229 !self . check_keyword ( keywords:: True ) &&
Original file line number Diff line number Diff line change 1010
1111// ignore-cross-compile
1212
13- // error-pattern:`let` is not an expression, so it cannot be used in this way
13+ // error-pattern:expected expression, found statement (`let`)
1414
1515#![ feature( quote, rustc_private) ]
1616
You can’t perform that action at this time.
0 commit comments