@@ -627,8 +627,14 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
627
627
subpattern : None ,
628
628
..
629
629
} => {
630
- let place =
631
- self . storage_live_binding ( block, var, irrefutable_pat. span , OutsideGuard , true ) ;
630
+ let place = self . storage_live_binding (
631
+ block,
632
+ var,
633
+ irrefutable_pat. span ,
634
+ false ,
635
+ OutsideGuard ,
636
+ true ,
637
+ ) ;
632
638
unpack ! ( block = self . expr_into_dest( place, block, initializer_id) ) ;
633
639
634
640
// Inject a fake read, see comments on `FakeReadCause::ForLet`.
@@ -661,8 +667,14 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
661
667
} ,
662
668
ascription : thir:: Ascription { ref annotation, variance : _ } ,
663
669
} => {
664
- let place =
665
- self . storage_live_binding ( block, var, irrefutable_pat. span , OutsideGuard , true ) ;
670
+ let place = self . storage_live_binding (
671
+ block,
672
+ var,
673
+ irrefutable_pat. span ,
674
+ false ,
675
+ OutsideGuard ,
676
+ true ,
677
+ ) ;
666
678
unpack ! ( block = self . expr_into_dest( place, block, initializer_id) ) ;
667
679
668
680
// Inject a fake read, see comments on `FakeReadCause::ForLet`.
@@ -855,6 +867,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
855
867
block : BasicBlock ,
856
868
var : LocalVarId ,
857
869
span : Span ,
870
+ is_shorthand : bool ,
858
871
for_guard : ForGuard ,
859
872
schedule_drop : bool ,
860
873
) -> Place < ' tcx > {
@@ -868,6 +881,10 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
868
881
{
869
882
self . schedule_drop ( span, region_scope, local_id, DropKind :: Storage ) ;
870
883
}
884
+ let local_info = self . local_decls [ local_id] . local_info . as_mut ( ) . assert_crate_local ( ) ;
885
+ if let LocalInfo :: User ( BindingForm :: Var ( var_info) ) = & mut * * local_info {
886
+ var_info. introductions . push ( ( span, is_shorthand) ) ;
887
+ }
871
888
Place :: from ( local_id)
872
889
}
873
890
@@ -1149,6 +1166,7 @@ struct Binding<'tcx> {
1149
1166
source : Place < ' tcx > ,
1150
1167
var_id : LocalVarId ,
1151
1168
binding_mode : BindingAnnotation ,
1169
+ is_shorthand : bool ,
1152
1170
}
1153
1171
1154
1172
/// Indicates that the type of `source` must be a subtype of the
@@ -2332,6 +2350,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
2332
2350
block,
2333
2351
binding. var_id ,
2334
2352
binding. span ,
2353
+ binding. is_shorthand ,
2335
2354
RefWithinGuard ,
2336
2355
schedule_drops,
2337
2356
) ;
@@ -2345,6 +2364,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
2345
2364
block,
2346
2365
binding. var_id ,
2347
2366
binding. span ,
2367
+ binding. is_shorthand ,
2348
2368
OutsideGuard ,
2349
2369
schedule_drops,
2350
2370
) ;
@@ -2384,6 +2404,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
2384
2404
block,
2385
2405
binding. var_id ,
2386
2406
binding. span ,
2407
+ binding. is_shorthand ,
2387
2408
OutsideGuard ,
2388
2409
schedule_drops,
2389
2410
)
@@ -2437,6 +2458,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
2437
2458
opt_ty_info : None ,
2438
2459
opt_match_place,
2439
2460
pat_span,
2461
+ introductions : Vec :: new ( ) ,
2440
2462
} ,
2441
2463
) ) ) ) ,
2442
2464
} ;
0 commit comments