@@ -73,20 +73,23 @@ impl<'a> Parser<'a> {
73
73
lo,
74
74
attrs,
75
75
errors:: InvalidVariableDeclarationSub :: MissingLet ,
76
+ force_collect,
76
77
) ?
77
78
} else if self . is_kw_followed_by_ident ( kw:: Auto ) && self . may_recover ( ) {
78
79
self . bump ( ) ; // `auto`
79
80
self . recover_stmt_local_after_let (
80
81
lo,
81
82
attrs,
82
83
errors:: InvalidVariableDeclarationSub :: UseLetNotAuto ,
84
+ force_collect,
83
85
) ?
84
86
} else if self . is_kw_followed_by_ident ( sym:: var) && self . may_recover ( ) {
85
87
self . bump ( ) ; // `var`
86
88
self . recover_stmt_local_after_let (
87
89
lo,
88
90
attrs,
89
91
errors:: InvalidVariableDeclarationSub :: UseLetNotVar ,
92
+ force_collect,
90
93
) ?
91
94
} else if self . check_path ( )
92
95
&& !self . token . is_qpath_start ( )
@@ -236,16 +239,16 @@ impl<'a> Parser<'a> {
236
239
lo : Span ,
237
240
attrs : AttrWrapper ,
238
241
subdiagnostic : fn ( Span ) -> errors:: InvalidVariableDeclarationSub ,
242
+ force_collect : ForceCollect ,
239
243
) -> 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
+ } ) ?;
249
252
self . dcx ( )
250
253
. emit_err ( errors:: InvalidVariableDeclaration { span : lo, sub : subdiagnostic ( lo) } ) ;
251
254
Ok ( stmt)
0 commit comments