@@ -132,13 +132,8 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
132
132
// check safety.
133
133
134
134
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());
142
137
143
138
// Step 2. Create the otherwise and prebinding blocks.
144
139
@@ -314,16 +309,9 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
314
309
self.storage_live_binding(block, var, irrefutable_pat.span, OutsideGuard);
315
310
unpack!(block = self.into(&place, block, initializer));
316
311
317
-
318
312
// Inject a fake read, see comments on `FakeReadCause::ForLet`.
319
313
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);
327
315
328
316
self.schedule_drop_for_binding(var, irrefutable_pat.span, OutsideGuard);
329
317
block.unit()
@@ -359,13 +347,8 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
359
347
360
348
// Inject a fake read, see comments on `FakeReadCause::ForLet`.
361
349
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());
369
352
370
353
let ty_source_info = self.source_info(user_ty_span);
371
354
let user_ty = pat_ascription_ty.user_ty(
@@ -1516,13 +1499,8 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
1516
1499
);
1517
1500
1518
1501
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));
1526
1504
}
1527
1505
1528
1506
self.exit_scope(
@@ -1565,14 +1543,8 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
1565
1543
// place they refer to can't be modified by the guard.
1566
1544
for binding in by_value_bindings.clone() {
1567
1545
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));
1576
1548
}
1577
1549
self.bind_matched_candidate_for_arm_body(
1578
1550
post_guard_block,
0 commit comments