fix precise live drops

This commit is contained in:
Deadbeef 2021-09-03 09:53:57 +00:00
parent 122e91e330
commit 49ac725d51
No known key found for this signature in database
GPG key ID: 027DF9338862ADDD
5 changed files with 38 additions and 7 deletions

View file

@ -79,9 +79,9 @@ impl Visitor<'tcx> for CheckLiveDrops<'mir, 'tcx> {
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) {
bug!(
"Drop elaboration left behind a Drop for a type that does not need dropping"
);
// Instead of throwing a bug, we just return here. This is because we have to
// run custom `const Drop` impls.
return;
}
if dropped_place.is_indirect() {