File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -2156,12 +2156,6 @@ impl<'a> Parser<'a> {
21562156 let lo = self . last_span . lo ;
21572157 return self . parse_while_expr ( None , lo, attrs) ;
21582158 }
2159- if self . token . is_keyword ( keywords:: Let ) {
2160- // Catch this syntax error here, instead of in `check_strict_keywords`, so
2161- // that we can explicitly mention that let is not to be used as an expression
2162- let msg = "`let` is not an expression, so it cannot be used in this way" ;
2163- self . span_err ( self . span , msg) ;
2164- }
21652159 if self . token . is_lifetime ( ) {
21662160 let lifetime = self . get_lifetime ( ) ;
21672161 let lo = self . span . lo ;
@@ -2224,6 +2218,11 @@ impl<'a> Parser<'a> {
22242218 ex = ExprBreak ( None ) ;
22252219 }
22262220 hi = self . last_span . hi ;
2221+ } else if self . token . is_keyword ( keywords:: Let ) {
2222+ // Catch this syntax error here, instead of in `check_strict_keywords`, so
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) ) ;
22272226 } else if self . check ( & token:: ModSep ) ||
22282227 self . token . is_ident ( ) &&
22292228 !self . check_keyword ( keywords:: True ) &&
You can’t perform that action at this time.
0 commit comments