@@ -72,20 +72,23 @@ impl<'a> Parser<'a> {
72
72
lo,
73
73
attrs,
74
74
errors:: InvalidVariableDeclarationSub :: MissingLet ,
75
+ force_collect,
75
76
) ?
76
77
} else if self . is_kw_followed_by_ident ( kw:: Auto ) && self . may_recover ( ) {
77
78
self . bump ( ) ; // `auto`
78
79
self . recover_stmt_local_after_let (
79
80
lo,
80
81
attrs,
81
82
errors:: InvalidVariableDeclarationSub :: UseLetNotAuto ,
83
+ force_collect,
82
84
) ?
83
85
} else if self . is_kw_followed_by_ident ( sym:: var) && self . may_recover ( ) {
84
86
self . bump ( ) ; // `var`
85
87
self . recover_stmt_local_after_let (
86
88
lo,
87
89
attrs,
88
90
errors:: InvalidVariableDeclarationSub :: UseLetNotVar ,
91
+ force_collect,
89
92
) ?
90
93
} else if self . check_path ( )
91
94
&& !self . token . is_qpath_start ( )
@@ -231,13 +234,13 @@ impl<'a> Parser<'a> {
231
234
lo : Span ,
232
235
attrs : AttrWrapper ,
233
236
subdiagnostic : fn ( Span ) -> errors:: InvalidVariableDeclarationSub ,
237
+ force_collect : ForceCollect ,
234
238
) -> PResult < ' a , Stmt > {
235
- let stmt =
236
- self . collect_tokens_trailing_token ( attrs, ForceCollect :: Yes , |this, attrs| {
237
- let local = this. parse_local ( attrs) ?;
238
- // FIXME - maybe capture semicolon in recovery?
239
- Ok ( ( this. mk_stmt ( lo. to ( this. prev_token . span ) , StmtKind :: Let ( local) ) , false ) )
240
- } ) ?;
239
+ let stmt = self . collect_tokens_trailing_token ( attrs, force_collect, |this, attrs| {
240
+ let local = this. parse_local ( attrs) ?;
241
+ // FIXME - maybe capture semicolon in recovery?
242
+ Ok ( ( this. mk_stmt ( lo. to ( this. prev_token . span ) , StmtKind :: Let ( local) ) , false ) )
243
+ } ) ?;
241
244
self . dcx ( )
242
245
. emit_err ( errors:: InvalidVariableDeclaration { span : lo, sub : subdiagnostic ( lo) } ) ;
243
246
Ok ( stmt)
0 commit comments