@@ -2480,9 +2480,9 @@ impl<'a> Parser<'a> {
2480
2480
2481
2481
let mut checker = CondChecker :: new ( self ) ;
2482
2482
checker. visit_expr ( & mut cond) ;
2483
- if checker. seen_missing_let {
2483
+ if checker. seen_missing_let . is_some ( ) {
2484
2484
// Avoid unnecessary resolve errors as we know we'll have some.
2485
- * self . sess . silence_resolve_errors . borrow_mut ( ) = true ;
2485
+ * self . sess . silence_resolve_errors . borrow_mut ( ) = checker . seen_missing_let ;
2486
2486
}
2487
2487
self . sess . silence_missing_comparison . borrow_mut ( ) . append ( & mut checker. seen_comparison ) ;
2488
2488
@@ -3562,7 +3562,7 @@ struct CondChecker<'a> {
3562
3562
parser : & ' a Parser < ' a > ,
3563
3563
forbid_let_reason : Option < ForbiddenLetReason > ,
3564
3564
missing_let : Option < errors:: MaybeMissingLet > ,
3565
- seen_missing_let : bool ,
3565
+ seen_missing_let : Option < ErrorGuaranteed > ,
3566
3566
comparison : Option < errors:: MaybeComparison > ,
3567
3567
seen_comparison : Vec < Span > ,
3568
3568
}
@@ -3573,7 +3573,7 @@ impl<'a> CondChecker<'a> {
3573
3573
parser,
3574
3574
forbid_let_reason : None ,
3575
3575
missing_let : None ,
3576
- seen_missing_let : false ,
3576
+ seen_missing_let : None ,
3577
3577
comparison : None ,
3578
3578
seen_comparison : vec ! [ ] ,
3579
3579
}
@@ -3591,13 +3591,16 @@ impl MutVisitor for CondChecker<'_> {
3591
3591
if let Some ( comparison) = self . comparison {
3592
3592
self . seen_comparison . push ( comparison. span ) ;
3593
3593
}
3594
- * is_recovered =
3595
- Some ( self . parser . sess . emit_err ( errors:: ExpectedExpressionFoundLet {
3596
- span,
3597
- reason,
3598
- missing_let : self . missing_let ,
3599
- comparison : self . comparison ,
3600
- } ) ) ;
3594
+ let error = self . parser . sess . emit_err ( errors:: ExpectedExpressionFoundLet {
3595
+ span,
3596
+ reason,
3597
+ missing_let : self . missing_let ,
3598
+ comparison : self . comparison ,
3599
+ } ) ;
3600
+ * is_recovered = Some ( error) ;
3601
+ if self . missing_let . is_some ( ) {
3602
+ self . seen_missing_let = Some ( error) ;
3603
+ }
3601
3604
} else {
3602
3605
self . parser . sess . gated_spans . gate ( sym:: let_chains, span) ;
3603
3606
}
@@ -3631,7 +3634,6 @@ impl MutVisitor for CondChecker<'_> {
3631
3634
| ExprKind :: Call ( _, _)
3632
3635
| ExprKind :: Array ( _) = rhs. kind
3633
3636
{
3634
- self . seen_missing_let = true ;
3635
3637
self . missing_let =
3636
3638
Some ( errors:: MaybeMissingLet { span : rhs. span . shrink_to_lo ( ) } ) ;
3637
3639
}
0 commit comments