@@ -131,13 +131,8 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
131
131
// check safety.
132
132
133
133
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 ( ) ) ;
141
136
142
137
// Step 2. Create the otherwise and prebinding blocks.
143
138
@@ -313,16 +308,9 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
313
308
self . storage_live_binding ( block, var, irrefutable_pat. span , OutsideGuard ) ;
314
309
unpack ! ( block = self . into( & place, block, initializer) ) ;
315
310
316
-
317
311
// Inject a fake read, see comments on `FakeReadCause::ForLet`.
318
312
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) ;
326
314
327
315
self . schedule_drop_for_binding ( var, irrefutable_pat. span , OutsideGuard ) ;
328
316
block. unit ( )
@@ -358,13 +346,8 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
358
346
359
347
// Inject a fake read, see comments on `FakeReadCause::ForLet`.
360
348
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 ( ) ) ;
368
351
369
352
let ty_source_info = self . source_info ( user_ty_span) ;
370
353
let user_ty = pat_ascription_ty. user_ty (
@@ -1515,13 +1498,8 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
1515
1498
) ;
1516
1499
1517
1500
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) ) ;
1525
1503
}
1526
1504
1527
1505
self . exit_scope (
@@ -1564,14 +1542,8 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
1564
1542
// place they refer to can't be modified by the guard.
1565
1543
for binding in by_value_bindings. clone ( ) {
1566
1544
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) ) ;
1575
1547
}
1576
1548
self . bind_matched_candidate_for_arm_body (
1577
1549
post_guard_block,
0 commit comments