Skip to content

Commit 046165a

Browse files
committed
rename location field of Drop terminators to place
1 parent 302fb50 commit 046165a

File tree

25 files changed

+99
-111
lines changed

25 files changed

+99
-111
lines changed

src/librustc_codegen_ssa/mir/block.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -998,8 +998,8 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
998998
bx.unreachable();
999999
}
10001000

1001-
mir::TerminatorKind::Drop { location, target, unwind } => {
1002-
self.codegen_drop_terminator(helper, bx, location, target, unwind);
1001+
mir::TerminatorKind::Drop { place, target, unwind } => {
1002+
self.codegen_drop_terminator(helper, bx, place, target, unwind);
10031003
}
10041004

10051005
mir::TerminatorKind::Assert { ref cond, expected, ref msg, target, cleanup } => {

src/librustc_middle/mir/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1112,7 +1112,7 @@ pub enum TerminatorKind<'tcx> {
11121112
Unreachable,
11131113

11141114
/// Drop the `Place`.
1115-
Drop { location: Place<'tcx>, target: BasicBlock, unwind: Option<BasicBlock> },
1115+
Drop { place: Place<'tcx>, target: BasicBlock, unwind: Option<BasicBlock> },
11161116

11171117
/// Drop the `Place` and assign the new value over it. This ensures
11181118
/// that the assignment to `P` occurs *even if* the destructor for
@@ -1141,7 +1141,7 @@ pub enum TerminatorKind<'tcx> {
11411141
/// }
11421142
/// ```
11431143
DropAndReplace {
1144-
location: Place<'tcx>,
1144+
place: Place<'tcx>,
11451145
value: Operand<'tcx>,
11461146
target: BasicBlock,
11471147
unwind: Option<BasicBlock>,
@@ -1607,9 +1607,9 @@ impl<'tcx> TerminatorKind<'tcx> {
16071607
Abort => write!(fmt, "abort"),
16081608
Yield { value, resume_arg, .. } => write!(fmt, "{:?} = yield({:?})", resume_arg, value),
16091609
Unreachable => write!(fmt, "unreachable"),
1610-
Drop { location, .. } => write!(fmt, "drop({:?})", location),
1611-
DropAndReplace { location, value, .. } => {
1612-
write!(fmt, "replace({:?} <- {:?})", location, value)
1610+
Drop { place, .. } => write!(fmt, "drop({:?})", place),
1611+
DropAndReplace { place, value, .. } => {
1612+
write!(fmt, "replace({:?} <- {:?})", place, value)
16131613
}
16141614
Call { func, args, destination, .. } => {
16151615
if let Some((destination, _)) = destination {

src/librustc_middle/mir/type_foldable.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ impl<'tcx> TypeFoldable<'tcx> for Terminator<'tcx> {
2727
values: values.clone(),
2828
targets: targets.clone(),
2929
},
30-
Drop { ref location, target, unwind } => {
31-
Drop { location: location.fold_with(folder), target, unwind }
30+
Drop { ref place, target, unwind } => {
31+
Drop { place: place.fold_with(folder), target, unwind }
3232
}
33-
DropAndReplace { ref location, ref value, target, unwind } => DropAndReplace {
34-
location: location.fold_with(folder),
33+
DropAndReplace { ref place, ref value, target, unwind } => DropAndReplace {
34+
place: place.fold_with(folder),
3535
value: value.fold_with(folder),
3636
target,
3737
unwind,
@@ -97,9 +97,9 @@ impl<'tcx> TypeFoldable<'tcx> for Terminator<'tcx> {
9797
SwitchInt { ref discr, switch_ty, .. } => {
9898
discr.visit_with(visitor) || switch_ty.visit_with(visitor)
9999
}
100-
Drop { ref location, .. } => location.visit_with(visitor),
101-
DropAndReplace { ref location, ref value, .. } => {
102-
location.visit_with(visitor) || value.visit_with(visitor)
100+
Drop { ref place, .. } => place.visit_with(visitor),
101+
DropAndReplace { ref place, ref value, .. } => {
102+
place.visit_with(visitor) || value.visit_with(visitor)
103103
}
104104
Yield { ref value, .. } => value.visit_with(visitor),
105105
Call { ref func, ref args, ref destination, .. } => {

src/librustc_middle/mir/visit.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -449,25 +449,25 @@ macro_rules! make_mir_visitor {
449449
}
450450

451451
TerminatorKind::Drop {
452-
location,
452+
place,
453453
target: _,
454454
unwind: _,
455455
} => {
456456
self.visit_place(
457-
location,
457+
place,
458458
PlaceContext::MutatingUse(MutatingUseContext::Drop),
459459
source_location
460460
);
461461
}
462462

463463
TerminatorKind::DropAndReplace {
464-
location,
464+
place,
465465
value,
466466
target: _,
467467
unwind: _,
468468
} => {
469469
self.visit_place(
470-
location,
470+
place,
471471
PlaceContext::MutatingUse(MutatingUseContext::Drop),
472472
source_location
473473
);

src/librustc_mir/borrow_check/invalidation.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ impl<'cx, 'tcx> Visitor<'tcx> for InvalidationGenerator<'cx, 'tcx> {
119119
TerminatorKind::SwitchInt { ref discr, switch_ty: _, values: _, targets: _ } => {
120120
self.consume_operand(location, discr);
121121
}
122-
TerminatorKind::Drop { location: drop_place, target: _, unwind: _ } => {
122+
TerminatorKind::Drop { place: drop_place, target: _, unwind: _ } => {
123123
self.access_place(
124124
location,
125125
*drop_place,
@@ -128,7 +128,7 @@ impl<'cx, 'tcx> Visitor<'tcx> for InvalidationGenerator<'cx, 'tcx> {
128128
);
129129
}
130130
TerminatorKind::DropAndReplace {
131-
location: drop_place,
131+
place: drop_place,
132132
value: ref new_value,
133133
target: _,
134134
unwind: _,

src/librustc_mir/borrow_check/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -663,7 +663,7 @@ impl<'cx, 'tcx> dataflow::ResultsVisitor<'cx, 'tcx> for MirBorrowckCtxt<'cx, 'tc
663663
TerminatorKind::SwitchInt { ref discr, switch_ty: _, values: _, targets: _ } => {
664664
self.consume_operand(loc, (discr, span), flow_state);
665665
}
666-
TerminatorKind::Drop { location: ref drop_place, target: _, unwind: _ } => {
666+
TerminatorKind::Drop { place: ref drop_place, target: _, unwind: _ } => {
667667
let tcx = self.infcx.tcx;
668668

669669
// Compute the type with accurate region information.
@@ -692,7 +692,7 @@ impl<'cx, 'tcx> dataflow::ResultsVisitor<'cx, 'tcx> for MirBorrowckCtxt<'cx, 'tc
692692
);
693693
}
694694
TerminatorKind::DropAndReplace {
695-
location: drop_place,
695+
place: drop_place,
696696
value: ref new_value,
697697
target: _,
698698
unwind: _,

src/librustc_mir/borrow_check/type_check/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1558,8 +1558,8 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
15581558
// no checks needed for these
15591559
}
15601560

1561-
TerminatorKind::DropAndReplace { ref location, ref value, target: _, unwind: _ } => {
1562-
let place_ty = location.ty(body, tcx).ty;
1561+
TerminatorKind::DropAndReplace { ref place, ref value, target: _, unwind: _ } => {
1562+
let place_ty = place.ty(body, tcx).ty;
15631563
let rv_ty = value.ty(body, tcx);
15641564

15651565
let locations = term_location.to_locations();

src/librustc_mir/borrow_check/used_muts.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ impl<'visit, 'cx, 'tcx> Visitor<'tcx> for GatherUsedMutsVisitor<'visit, 'cx, 'tc
7070
TerminatorKind::Call { destination: Some((into, _)), .. } => {
7171
self.remove_never_initialized_mut_locals(*into);
7272
}
73-
TerminatorKind::DropAndReplace { location, .. } => {
74-
self.remove_never_initialized_mut_locals(*location);
73+
TerminatorKind::DropAndReplace { place, .. } => {
74+
self.remove_never_initialized_mut_locals(*place);
7575
}
7676
_ => {}
7777
}

src/librustc_mir/dataflow/framework/direction.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -441,8 +441,8 @@ impl Direction for Forward {
441441
Goto { target } => propagate(target, exit_state),
442442

443443
Assert { target, cleanup: unwind, expected: _, msg: _, cond: _ }
444-
| Drop { target, unwind, location: _ }
445-
| DropAndReplace { target, unwind, value: _, location: _ }
444+
| Drop { target, unwind, place: _ }
445+
| DropAndReplace { target, unwind, value: _, place: _ }
446446
| FalseUnwind { real_target: target, unwind } => {
447447
if let Some(unwind) = unwind {
448448
if dead_unwinds.map_or(true, |dead| !dead.contains(bb)) {

src/librustc_mir/dataflow/impls/borrowed_locals.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,8 @@ where
189189
self.super_terminator(terminator, location);
190190

191191
match terminator.kind {
192-
mir::TerminatorKind::Drop { location: dropped_place, .. }
193-
| mir::TerminatorKind::DropAndReplace { location: dropped_place, .. } => {
192+
mir::TerminatorKind::Drop { place: dropped_place, .. }
193+
| mir::TerminatorKind::DropAndReplace { place: dropped_place, .. } => {
194194
// See documentation for `unsound_ignore_borrow_on_drop` for an explanation.
195195
if !self.ignore_borrow_on_drop {
196196
self.trans.gen(dropped_place.local);

src/librustc_mir/dataflow/move_paths/builder.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -387,13 +387,13 @@ impl<'b, 'a, 'tcx> Gatherer<'b, 'a, 'tcx> {
387387
self.gather_init(place.as_ref(), InitKind::Deep);
388388
}
389389

390-
TerminatorKind::Drop { location, target: _, unwind: _ } => {
391-
self.gather_move(location);
390+
TerminatorKind::Drop { place, target: _, unwind: _ } => {
391+
self.gather_move(place);
392392
}
393-
TerminatorKind::DropAndReplace { location, ref value, .. } => {
394-
self.create_move_path(location);
393+
TerminatorKind::DropAndReplace { place, ref value, .. } => {
394+
self.create_move_path(place);
395395
self.gather_operand(value);
396-
self.gather_init(location.as_ref(), InitKind::Deep);
396+
self.gather_init(place.as_ref(), InitKind::Deep);
397397
}
398398
TerminatorKind::Call {
399399
ref func,

src/librustc_mir/interpret/terminator.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,10 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
9191
}
9292
}
9393

94-
Drop { location, target, unwind } => {
95-
let place = self.eval_place(location)?;
94+
Drop { place, target, unwind } => {
95+
let place = self.eval_place(place)?;
9696
let ty = place.layout.ty;
97-
trace!("TerminatorKind::drop: {:?}, type {}", location, ty);
97+
trace!("TerminatorKind::drop: {:?}, type {}", place, ty);
9898

9999
let instance = Instance::resolve_drop_in_place(*self.tcx, ty);
100100
self.drop_in_place(place, instance, target, unwind)?;

src/librustc_mir/monomorphize/collector.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -626,9 +626,9 @@ impl<'a, 'tcx> MirVisitor<'tcx> for MirNeighborCollector<'a, 'tcx> {
626626
let callee_ty = self.monomorphize(callee_ty);
627627
visit_fn_use(self.tcx, callee_ty, true, &mut self.output);
628628
}
629-
mir::TerminatorKind::Drop { ref location, .. }
630-
| mir::TerminatorKind::DropAndReplace { ref location, .. } => {
631-
let ty = location.ty(self.body, self.tcx).ty;
629+
mir::TerminatorKind::Drop { ref place, .. }
630+
| mir::TerminatorKind::DropAndReplace { ref place, .. } => {
631+
let ty = place.ty(self.body, self.tcx).ty;
632632
let ty = self.monomorphize(ty);
633633
visit_drop_use(self.tcx, ty, true, self.output);
634634
}

src/librustc_mir/shim.rs

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,7 @@ impl CloneShimBuilder<'tcx> {
582582
self.block(
583583
vec![],
584584
TerminatorKind::Drop {
585-
location: self.tcx.mk_place_index(dest, beg),
585+
place: self.tcx.mk_place_index(dest, beg),
586586
target: BasicBlock::new(8),
587587
unwind: None,
588588
},
@@ -634,7 +634,7 @@ impl CloneShimBuilder<'tcx> {
634634
self.block(
635635
vec![],
636636
TerminatorKind::Drop {
637-
location: previous_field,
637+
place: previous_field,
638638
target: previous_cleanup,
639639
unwind: None,
640640
},
@@ -799,11 +799,7 @@ fn build_call_shim<'tcx>(
799799
block(
800800
&mut blocks,
801801
vec![],
802-
TerminatorKind::Drop {
803-
location: rcvr_place(),
804-
target: BasicBlock::new(2),
805-
unwind: None,
806-
},
802+
TerminatorKind::Drop { place: rcvr_place(), target: BasicBlock::new(2), unwind: None },
807803
false,
808804
);
809805
}
@@ -814,11 +810,7 @@ fn build_call_shim<'tcx>(
814810
block(
815811
&mut blocks,
816812
vec![],
817-
TerminatorKind::Drop {
818-
location: rcvr_place(),
819-
target: BasicBlock::new(4),
820-
unwind: None,
821-
},
813+
TerminatorKind::Drop { place: rcvr_place(), target: BasicBlock::new(4), unwind: None },
822814
true,
823815
);
824816

src/librustc_mir/transform/add_moves_for_packed_drops.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ fn add_moves_for_packed_drops_patch<'tcx>(
6464
let terminator = data.terminator();
6565

6666
match terminator.kind {
67-
TerminatorKind::Drop { location, .. }
68-
if util::is_disaligned(tcx, body, param_env, location) =>
67+
TerminatorKind::Drop { place, .. }
68+
if util::is_disaligned(tcx, body, param_env, place) =>
6969
{
7070
add_move_for_packed_drop(tcx, body, &mut patch, terminator, loc, data.is_cleanup);
7171
}
@@ -88,13 +88,13 @@ fn add_move_for_packed_drop<'tcx>(
8888
is_cleanup: bool,
8989
) {
9090
debug!("add_move_for_packed_drop({:?} @ {:?})", terminator, loc);
91-
let (location, target, unwind) = match terminator.kind {
92-
TerminatorKind::Drop { ref location, target, unwind } => (location, target, unwind),
91+
let (place, target, unwind) = match terminator.kind {
92+
TerminatorKind::Drop { ref place, target, unwind } => (place, target, unwind),
9393
_ => unreachable!(),
9494
};
9595

9696
let source_info = terminator.source_info;
97-
let ty = location.ty(body, tcx).ty;
97+
let ty = place.ty(body, tcx).ty;
9898
let temp = patch.new_temp(ty, terminator.source_info.span);
9999

100100
let storage_dead_block = patch.new_block(BasicBlockData {
@@ -104,9 +104,9 @@ fn add_move_for_packed_drop<'tcx>(
104104
});
105105

106106
patch.add_statement(loc, StatementKind::StorageLive(temp));
107-
patch.add_assign(loc, Place::from(temp), Rvalue::Use(Operand::Move(*location)));
107+
patch.add_assign(loc, Place::from(temp), Rvalue::Use(Operand::Move(*place)));
108108
patch.patch_terminator(
109109
loc.block,
110-
TerminatorKind::Drop { location: Place::from(temp), target: storage_dead_block, unwind },
110+
TerminatorKind::Drop { place: Place::from(temp), target: storage_dead_block, unwind },
111111
);
112112
}

src/librustc_mir/transform/check_consts/post_drop_elaboration.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ impl Visitor<'tcx> for CheckLiveDrops<'mir, 'tcx> {
7878
trace!("visit_terminator: terminator={:?} location={:?}", terminator, location);
7979

8080
match &terminator.kind {
81-
mir::TerminatorKind::Drop { location: dropped_place, .. } => {
81+
mir::TerminatorKind::Drop { place: dropped_place, .. } => {
8282
let dropped_ty = dropped_place.ty(self.body, self.tcx).ty;
8383
if !NeedsDrop::in_any_value_of_ty(self.ccx, dropped_ty) {
8484
return;

src/librustc_mir/transform/check_consts/resolver.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,16 +125,15 @@ where
125125
// The effect of assignment to the return place in `TerminatorKind::Call` is not applied
126126
// here; that occurs in `apply_call_return_effect`.
127127

128-
if let mir::TerminatorKind::DropAndReplace { value, location: dest, .. } = &terminator.kind
129-
{
128+
if let mir::TerminatorKind::DropAndReplace { value, place, .. } = &terminator.kind {
130129
let qualif = qualifs::in_operand::<Q, _>(
131130
self.ccx,
132131
&mut |l| self.qualifs_per_local.contains(l),
133132
value,
134133
);
135134

136-
if !dest.is_indirect() {
137-
self.assign_qualif_direct(dest, qualif);
135+
if !place.is_indirect() {
136+
self.assign_qualif_direct(place, qualif);
138137
}
139138
}
140139

src/librustc_mir/transform/check_consts/validation.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -560,8 +560,8 @@ impl Visitor<'tcx> for Validator<'mir, 'tcx> {
560560

561561
// Forbid all `Drop` terminators unless the place being dropped is a local with no
562562
// projections that cannot be `NeedsDrop`.
563-
TerminatorKind::Drop { location: dropped_place, .. }
564-
| TerminatorKind::DropAndReplace { location: dropped_place, .. } => {
563+
TerminatorKind::Drop { place: dropped_place, .. }
564+
| TerminatorKind::DropAndReplace { place: dropped_place, .. } => {
565565
// If we are checking live drops after drop-elaboration, don't emit duplicate
566566
// errors here.
567567
if super::post_drop_elaboration::checking_enabled(self.tcx) {

0 commit comments

Comments
 (0)