Remove DropAndReplace terminator
PR 107844 made DropAndReplace unused, let's remove it completely from the codebase.
This commit is contained in:
parent
14c54b637b
commit
c5d4e4d907
48 changed files with 33 additions and 341 deletions
|
@ -171,11 +171,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
|
|||
Unreachable => throw_ub!(Unreachable),
|
||||
|
||||
// These should never occur for MIR we actually run.
|
||||
DropAndReplace { .. }
|
||||
| FalseEdge { .. }
|
||||
| FalseUnwind { .. }
|
||||
| Yield { .. }
|
||||
| GeneratorDrop => span_bug!(
|
||||
FalseEdge { .. } | FalseUnwind { .. } | Yield { .. } | GeneratorDrop => span_bug!(
|
||||
terminator.source_info.span,
|
||||
"{:#?} should have been eliminated by MIR pass",
|
||||
terminator.kind
|
||||
|
|
|
@ -977,8 +977,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,18 +222,6 @@ 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.
|
||||
|
||||
|
|
|
@ -835,18 +835,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