From dd2eabc49d415dd30cea0953df5d7659d4d9440f Mon Sep 17 00:00:00 2001 From: Tyler Mandry Date: Tue, 14 May 2019 14:08:31 -0700 Subject: [PATCH] Make MaybeStorageLive drop-aware --- src/librustc_mir/dataflow/impls/storage_liveness.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/librustc_mir/dataflow/impls/storage_liveness.rs b/src/librustc_mir/dataflow/impls/storage_liveness.rs index 6b8eb6f17f6c..3bf11c57379c 100644 --- a/src/librustc_mir/dataflow/impls/storage_liveness.rs +++ b/src/librustc_mir/dataflow/impls/storage_liveness.rs @@ -43,9 +43,14 @@ impl<'a, 'tcx> BitDenotation<'tcx> for MaybeStorageLive<'a, 'tcx> { } fn terminator_effect(&self, - _sets: &mut BlockSets<'_, Local>, - _loc: Location) { - // Terminators have no effect + sets: &mut BlockSets<'_, Local>, + loc: Location) { + match &self.mir[loc.block].terminator().kind { + TerminatorKind::Drop { location, .. } => if let Some(l) = location.local() { + sets.kill(l); + } + _ => (), + } } fn propagate_call_return(