@@ -72,12 +72,12 @@ impl<'a> Parser<'a> {
7272
7373 Ok ( Some ( if self . token . is_keyword ( kw:: Let ) {
7474 self . parse_local_mk ( lo, attrs, capture_semi, force_collect) ?
75- } else if self . is_kw_followed_by_ident ( kw:: Mut ) {
75+ } else if self . is_kw_followed_by_ident ( kw:: Mut ) && self . may_recover ( ) {
7676 self . recover_stmt_local ( lo, attrs, InvalidVariableDeclarationSub :: MissingLet ) ?
77- } else if self . is_kw_followed_by_ident ( kw:: Auto ) {
77+ } else if self . is_kw_followed_by_ident ( kw:: Auto ) && self . may_recover ( ) {
7878 self . bump ( ) ; // `auto`
7979 self . recover_stmt_local ( lo, attrs, InvalidVariableDeclarationSub :: UseLetNotAuto ) ?
80- } else if self . is_kw_followed_by_ident ( sym:: var) {
80+ } else if self . is_kw_followed_by_ident ( sym:: var) && self . may_recover ( ) {
8181 self . bump ( ) ; // `var`
8282 self . recover_stmt_local ( lo, attrs, InvalidVariableDeclarationSub :: UseLetNotVar ) ?
8383 } else if self . check_path ( ) && !self . token . is_qpath_start ( ) && !self . is_path_start_item ( ) {
@@ -244,7 +244,7 @@ impl<'a> Parser<'a> {
244244 }
245245
246246 fn recover_local_after_let ( & mut self , lo : Span , attrs : AttrWrapper ) -> PResult < ' a , Stmt > {
247- self . collect_tokens_trailing_token ( attrs, ForceCollect :: No , |this, attrs| {
247+ self . collect_tokens_trailing_token ( attrs, ForceCollect :: Yes , |this, attrs| {
248248 let local = this. parse_local ( attrs) ?;
249249 // FIXME - maybe capture semicolon in recovery?
250250 Ok ( (
0 commit comments