@@ -627,8 +627,14 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
627627 subpattern : None ,
628628 ..
629629 } => {
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+ ) ;
632638 unpack ! ( block = self . expr_into_dest( place, block, initializer_id) ) ;
633639
634640 // Inject a fake read, see comments on `FakeReadCause::ForLet`.
@@ -661,8 +667,14 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
661667 } ,
662668 ascription : thir:: Ascription { ref annotation, variance : _ } ,
663669 } => {
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+ ) ;
666678 unpack ! ( block = self . expr_into_dest( place, block, initializer_id) ) ;
667679
668680 // Inject a fake read, see comments on `FakeReadCause::ForLet`.
@@ -855,6 +867,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
855867 block : BasicBlock ,
856868 var : LocalVarId ,
857869 span : Span ,
870+ is_shorthand : bool ,
858871 for_guard : ForGuard ,
859872 schedule_drop : bool ,
860873 ) -> Place < ' tcx > {
@@ -868,6 +881,10 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
868881 {
869882 self . schedule_drop ( span, region_scope, local_id, DropKind :: Storage ) ;
870883 }
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+ }
871888 Place :: from ( local_id)
872889 }
873890
@@ -1149,6 +1166,7 @@ struct Binding<'tcx> {
11491166 source : Place < ' tcx > ,
11501167 var_id : LocalVarId ,
11511168 binding_mode : BindingAnnotation ,
1169+ is_shorthand : bool ,
11521170}
11531171
11541172/// Indicates that the type of `source` must be a subtype of the
@@ -2332,6 +2350,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
23322350 block,
23332351 binding. var_id ,
23342352 binding. span ,
2353+ binding. is_shorthand ,
23352354 RefWithinGuard ,
23362355 schedule_drops,
23372356 ) ;
@@ -2345,6 +2364,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
23452364 block,
23462365 binding. var_id ,
23472366 binding. span ,
2367+ binding. is_shorthand ,
23482368 OutsideGuard ,
23492369 schedule_drops,
23502370 ) ;
@@ -2384,6 +2404,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
23842404 block,
23852405 binding. var_id ,
23862406 binding. span ,
2407+ binding. is_shorthand ,
23872408 OutsideGuard ,
23882409 schedule_drops,
23892410 )
@@ -2437,6 +2458,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
24372458 opt_ty_info : None ,
24382459 opt_match_place,
24392460 pat_span,
2461+ introductions : Vec :: new ( ) ,
24402462 } ,
24412463 ) ) ) ) ,
24422464 } ;
0 commit comments