@@ -132,13 +132,8 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
132132 // check safety.
133133
134134 let source_info = self . source_info ( scrutinee_span) ;
135- self . cfg . push ( block, Statement {
136- source_info,
137- kind : StatementKind :: FakeRead (
138- FakeReadCause :: ForMatchedPlace ,
139- box ( scrutinee_place. clone ( ) ) ,
140- ) ,
141- } ) ;
135+ let cause_matched_place = FakeReadCause :: ForMatchedPlace ;
136+ self . cfg . push_fake_read ( block, source_info, cause_matched_place, scrutinee_place. clone ( ) ) ;
142137
143138 // Step 2. Create the otherwise and prebinding blocks.
144139
@@ -314,16 +309,9 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
314309 self . storage_live_binding ( block, var, irrefutable_pat. span , OutsideGuard ) ;
315310 unpack ! ( block = self . into( & place, block, initializer) ) ;
316311
317-
318312 // Inject a fake read, see comments on `FakeReadCause::ForLet`.
319313 let source_info = self . source_info ( irrefutable_pat. span ) ;
320- self . cfg . push (
321- block,
322- Statement {
323- source_info,
324- kind : StatementKind :: FakeRead ( FakeReadCause :: ForLet , box ( place) ) ,
325- } ,
326- ) ;
314+ self . cfg . push_fake_read ( block, source_info, FakeReadCause :: ForLet , place) ;
327315
328316 self . schedule_drop_for_binding ( var, irrefutable_pat. span , OutsideGuard ) ;
329317 block. unit ( )
@@ -359,13 +347,8 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
359347
360348 // Inject a fake read, see comments on `FakeReadCause::ForLet`.
361349 let pattern_source_info = self . source_info ( irrefutable_pat. span ) ;
362- self . cfg . push (
363- block,
364- Statement {
365- source_info : pattern_source_info,
366- kind : StatementKind :: FakeRead ( FakeReadCause :: ForLet , box ( place. clone ( ) ) ) ,
367- } ,
368- ) ;
350+ let cause_let = FakeReadCause :: ForLet ;
351+ self . cfg . push_fake_read ( block, pattern_source_info, cause_let, place. clone ( ) ) ;
369352
370353 let ty_source_info = self . source_info ( user_ty_span) ;
371354 let user_ty = pat_ascription_ty. user_ty (
@@ -1516,13 +1499,8 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
15161499 ) ;
15171500
15181501 for & ( _, temp) in fake_borrows {
1519- self . cfg . push ( post_guard_block, Statement {
1520- source_info : guard_end,
1521- kind : StatementKind :: FakeRead (
1522- FakeReadCause :: ForMatchGuard ,
1523- box ( Place :: from ( temp) ) ,
1524- ) ,
1525- } ) ;
1502+ let cause = FakeReadCause :: ForMatchGuard ;
1503+ self . cfg . push_fake_read ( post_guard_block, guard_end, cause, Place :: from ( temp) ) ;
15261504 }
15271505
15281506 self . exit_scope (
@@ -1565,14 +1543,8 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
15651543 // place they refer to can't be modified by the guard.
15661544 for binding in by_value_bindings. clone ( ) {
15671545 let local_id = self . var_local_id ( binding. var_id , RefWithinGuard ) ;
1568- let place = Place :: from ( local_id) ;
1569- self . cfg . push (
1570- post_guard_block,
1571- Statement {
1572- source_info : guard_end,
1573- kind : StatementKind :: FakeRead ( FakeReadCause :: ForGuardBinding , box ( place) ) ,
1574- } ,
1575- ) ;
1546+ let cause = FakeReadCause :: ForGuardBinding ;
1547+ self . cfg . push_fake_read ( post_guard_block, guard_end, cause, Place :: from ( local_id) ) ;
15761548 }
15771549 self . bind_matched_candidate_for_arm_body (
15781550 post_guard_block,
0 commit comments