@@ -73,20 +73,23 @@ impl<'a> Parser<'a> {
7373 lo,
7474 attrs,
7575 errors:: InvalidVariableDeclarationSub :: MissingLet ,
76+ force_collect,
7677 ) ?
7778 } else if self . is_kw_followed_by_ident ( kw:: Auto ) && self . may_recover ( ) {
7879 self . bump ( ) ; // `auto`
7980 self . recover_stmt_local_after_let (
8081 lo,
8182 attrs,
8283 errors:: InvalidVariableDeclarationSub :: UseLetNotAuto ,
84+ force_collect,
8385 ) ?
8486 } else if self . is_kw_followed_by_ident ( sym:: var) && self . may_recover ( ) {
8587 self . bump ( ) ; // `var`
8688 self . recover_stmt_local_after_let (
8789 lo,
8890 attrs,
8991 errors:: InvalidVariableDeclarationSub :: UseLetNotVar ,
92+ force_collect,
9093 ) ?
9194 } else if self . check_path ( )
9295 && !self . token . is_qpath_start ( )
@@ -236,16 +239,16 @@ impl<'a> Parser<'a> {
236239 lo : Span ,
237240 attrs : AttrWrapper ,
238241 subdiagnostic : fn ( Span ) -> errors:: InvalidVariableDeclarationSub ,
242+ force_collect : ForceCollect ,
239243 ) -> PResult < ' a , Stmt > {
240- let stmt =
241- self . collect_tokens_trailing_token ( attrs, ForceCollect :: Yes , |this, attrs| {
242- let local = this. parse_local ( attrs) ?;
243- // FIXME - maybe capture semicolon in recovery?
244- Ok ( (
245- this. mk_stmt ( lo. to ( this. prev_token . span ) , StmtKind :: Let ( local) ) ,
246- TrailingToken :: None ,
247- ) )
248- } ) ?;
244+ let stmt = self . collect_tokens_trailing_token ( attrs, force_collect, |this, attrs| {
245+ let local = this. parse_local ( attrs) ?;
246+ // FIXME - maybe capture semicolon in recovery?
247+ Ok ( (
248+ this. mk_stmt ( lo. to ( this. prev_token . span ) , StmtKind :: Let ( local) ) ,
249+ TrailingToken :: None ,
250+ ) )
251+ } ) ?;
249252 self . dcx ( )
250253 . emit_err ( errors:: InvalidVariableDeclaration { span : lo, sub : subdiagnostic ( lo) } ) ;
251254 Ok ( stmt)
0 commit comments