1
Fork 0

Safely handle partial drops

We previously weren't tracking partial re-inits while being too
aggressive around partial drops. With this change, we simply ignore
partial drops, which is the safer, more conservative choice.
This commit is contained in:
Eric Holk 2022-01-05 14:11:37 -08:00
parent 78c5644de5
commit 32930d9ea7
5 changed files with 88 additions and 3 deletions

View file

@ -85,7 +85,11 @@ impl<'tcx> expr_use_visitor::Delegate<'tcx> for ExprUseDelegate<'tcx> {
"consume {:?}; diag_expr_id={:?}, using parent {:?}",
place_with_id, diag_expr_id, parent
);
self.mark_consumed(parent, place_with_id.into());
// We do not currently support partial drops or reinits, so just ignore
// any places with projections.
if place_with_id.place.projections.is_empty() {
self.mark_consumed(parent, place_with_id.into());
}
}
fn borrow(