Handle DropAndReplace
in const-checking
It runs before the real drop elaboration pass.
This commit is contained in:
parent
ce2959da97
commit
3e0e8be037
1 changed files with 2 additions and 6 deletions
|
@ -80,7 +80,8 @@ impl Visitor<'tcx> for CheckLiveDrops<'mir, 'tcx> {
|
||||||
trace!("visit_terminator: terminator={:?} location={:?}", terminator, location);
|
trace!("visit_terminator: terminator={:?} location={:?}", terminator, location);
|
||||||
|
|
||||||
match &terminator.kind {
|
match &terminator.kind {
|
||||||
mir::TerminatorKind::Drop { place: dropped_place, .. } => {
|
mir::TerminatorKind::Drop { place: dropped_place, .. }
|
||||||
|
| mir::TerminatorKind::DropAndReplace { place: dropped_place, .. } => {
|
||||||
let dropped_ty = dropped_place.ty(self.body, self.tcx).ty;
|
let dropped_ty = dropped_place.ty(self.body, self.tcx).ty;
|
||||||
if !NeedsNonConstDrop::in_any_value_of_ty(self.ccx, dropped_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
|
// Instead of throwing a bug, we just return here. This is because we have to
|
||||||
|
@ -104,11 +105,6 @@ impl Visitor<'tcx> for CheckLiveDrops<'mir, 'tcx> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mir::TerminatorKind::DropAndReplace { .. } => span_bug!(
|
|
||||||
terminator.source_info.span,
|
|
||||||
"`DropAndReplace` should be removed by drop elaboration",
|
|
||||||
),
|
|
||||||
|
|
||||||
mir::TerminatorKind::Abort
|
mir::TerminatorKind::Abort
|
||||||
| mir::TerminatorKind::Call { .. }
|
| mir::TerminatorKind::Call { .. }
|
||||||
| mir::TerminatorKind::Assert { .. }
|
| mir::TerminatorKind::Assert { .. }
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue