@@ -131,13 +131,8 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
131131 // check safety.
132132
133133 let source_info = self . source_info ( scrutinee_span) ;
134- self . cfg . push ( block, Statement {
135- source_info,
136- kind : StatementKind :: FakeRead (
137- FakeReadCause :: ForMatchedPlace ,
138- box ( scrutinee_place. clone ( ) ) ,
139- ) ,
140- } ) ;
134+ let cause_matched_place = FakeReadCause :: ForMatchedPlace ;
135+ self . cfg . push_fake_read ( block, source_info, cause_matched_place, scrutinee_place. clone ( ) ) ;
141136
142137 // Step 2. Create the otherwise and prebinding blocks.
143138
@@ -313,16 +308,9 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
313308 self . storage_live_binding ( block, var, irrefutable_pat. span , OutsideGuard ) ;
314309 unpack ! ( block = self . into( & place, block, initializer) ) ;
315310
316-
317311 // Inject a fake read, see comments on `FakeReadCause::ForLet`.
318312 let source_info = self . source_info ( irrefutable_pat. span ) ;
319- self . cfg . push (
320- block,
321- Statement {
322- source_info,
323- kind : StatementKind :: FakeRead ( FakeReadCause :: ForLet , box ( place) ) ,
324- } ,
325- ) ;
313+ self . cfg . push_fake_read ( block, source_info, FakeReadCause :: ForLet , place) ;
326314
327315 self . schedule_drop_for_binding ( var, irrefutable_pat. span , OutsideGuard ) ;
328316 block. unit ( )
@@ -358,13 +346,8 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
358346
359347 // Inject a fake read, see comments on `FakeReadCause::ForLet`.
360348 let pattern_source_info = self . source_info ( irrefutable_pat. span ) ;
361- self . cfg . push (
362- block,
363- Statement {
364- source_info : pattern_source_info,
365- kind : StatementKind :: FakeRead ( FakeReadCause :: ForLet , box ( place. clone ( ) ) ) ,
366- } ,
367- ) ;
349+ let cause_let = FakeReadCause :: ForLet ;
350+ self . cfg . push_fake_read ( block, pattern_source_info, cause_let, place. clone ( ) ) ;
368351
369352 let ty_source_info = self . source_info ( user_ty_span) ;
370353 let user_ty = pat_ascription_ty. user_ty (
@@ -1515,13 +1498,8 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
15151498 ) ;
15161499
15171500 for & ( _, temp) in fake_borrows {
1518- self . cfg . push ( post_guard_block, Statement {
1519- source_info : guard_end,
1520- kind : StatementKind :: FakeRead (
1521- FakeReadCause :: ForMatchGuard ,
1522- box ( Place :: from ( temp) ) ,
1523- ) ,
1524- } ) ;
1501+ let cause = FakeReadCause :: ForMatchGuard ;
1502+ self . cfg . push_fake_read ( post_guard_block, guard_end, cause, Place :: from ( temp) ) ;
15251503 }
15261504
15271505 self . exit_scope (
@@ -1564,14 +1542,8 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
15641542 // place they refer to can't be modified by the guard.
15651543 for binding in by_value_bindings. clone ( ) {
15661544 let local_id = self . var_local_id ( binding. var_id , RefWithinGuard ) ;
1567- let place = Place :: from ( local_id) ;
1568- self . cfg . push (
1569- post_guard_block,
1570- Statement {
1571- source_info : guard_end,
1572- kind : StatementKind :: FakeRead ( FakeReadCause :: ForGuardBinding , box ( place) ) ,
1573- } ,
1574- ) ;
1545+ let cause = FakeReadCause :: ForGuardBinding ;
1546+ self . cfg . push_fake_read ( post_guard_block, guard_end, cause, Place :: from ( local_id) ) ;
15751547 }
15761548 self . bind_matched_candidate_for_arm_body (
15771549 post_guard_block,
0 commit comments