Rollup merge of #108856 - Zeegomo:remove-drop-and-rep, r=tmiasko
Remove DropAndReplace terminator #107844 made DropAndReplace unused, let's remove it completely from the codebase.
This commit is contained in:
commit
4e84fbf8a0
48 changed files with 33 additions and 344 deletions
|
@ -985,8 +985,7 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> {
|
|||
|
||||
// Forbid all `Drop` terminators unless the place being dropped is a local with no
|
||||
// projections that cannot be `NeedsNonConstDrop`.
|
||||
TerminatorKind::Drop { place: dropped_place, .. }
|
||||
| TerminatorKind::DropAndReplace { place: dropped_place, .. } => {
|
||||
TerminatorKind::Drop { place: dropped_place, .. } => {
|
||||
// If we are checking live drops after drop-elaboration, don't emit duplicate
|
||||
// errors here.
|
||||
if super::post_drop_elaboration::checking_enabled(self.ccx) {
|
||||
|
|
|
@ -80,8 +80,7 @@ impl<'tcx> Visitor<'tcx> for CheckLiveDrops<'_, 'tcx> {
|
|||
trace!("visit_terminator: terminator={:?} location={:?}", terminator, location);
|
||||
|
||||
match &terminator.kind {
|
||||
mir::TerminatorKind::Drop { place: dropped_place, .. }
|
||||
| mir::TerminatorKind::DropAndReplace { place: dropped_place, .. } => {
|
||||
mir::TerminatorKind::Drop { place: dropped_place, .. } => {
|
||||
let dropped_ty = dropped_place.ty(self.body, self.tcx).ty;
|
||||
if !NeedsNonConstDrop::in_any_value_of_ty(self.ccx, dropped_ty) {
|
||||
// Instead of throwing a bug, we just return here. This is because we have to
|
||||
|
|
|
@ -222,23 +222,8 @@ where
|
|||
// The effect of assignment to the return place in `TerminatorKind::Call` is not applied
|
||||
// here; that occurs in `apply_call_return_effect`.
|
||||
|
||||
if let mir::TerminatorKind::DropAndReplace { value, place, .. } = &terminator.kind {
|
||||
let qualif = qualifs::in_operand::<Q, _>(
|
||||
self.ccx,
|
||||
&mut |l| self.state.qualif.contains(l),
|
||||
value,
|
||||
);
|
||||
|
||||
if !place.is_indirect() {
|
||||
self.assign_qualif_direct(place, qualif);
|
||||
}
|
||||
}
|
||||
|
||||
// We ignore borrow on drop because custom drop impls are not allowed in consts.
|
||||
// FIXME: Reconsider if accounting for borrows in drops is necessary for const drop.
|
||||
|
||||
// We need to assign qualifs to the dropped location before visiting the operand that
|
||||
// replaces it since qualifs can be cleared on move.
|
||||
self.super_terminator(terminator, location);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -846,18 +846,6 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> {
|
|||
self.check_edge(location, *unwind, EdgeKind::Unwind);
|
||||
}
|
||||
}
|
||||
TerminatorKind::DropAndReplace { target, unwind, .. } => {
|
||||
if self.mir_phase >= MirPhase::Runtime(RuntimePhase::Initial) {
|
||||
self.fail(
|
||||
location,
|
||||
"`DropAndReplace` should have been removed during drop elaboration",
|
||||
);
|
||||
}
|
||||
self.check_edge(location, *target, EdgeKind::Normal);
|
||||
if let Some(unwind) = unwind {
|
||||
self.check_edge(location, *unwind, EdgeKind::Unwind);
|
||||
}
|
||||
}
|
||||
TerminatorKind::Call { func, args, destination, target, cleanup, .. } => {
|
||||
let func_ty = func.ty(&self.body.local_decls, self.tcx);
|
||||
match func_ty.kind() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue