diff --git a/src/librustc_mir/transform/borrow_check.rs b/src/librustc_mir/transform/borrow_check.rs index e1f79c2f364..b56d5d31f55 100644 --- a/src/librustc_mir/transform/borrow_check.rs +++ b/src/librustc_mir/transform/borrow_check.rs @@ -222,10 +222,17 @@ impl<'c, 'b, 'a: 'b+'c, 'gcx, 'tcx: 'a> DataflowResultsConsumer<'b, 'gcx> } StatementKind::Nop | StatementKind::Validate(..) | - StatementKind::StorageLive(..) | - StatementKind::StorageDead(..) => { + StatementKind::StorageLive(..) => { // ignored by borrowck } + + StatementKind::StorageDead(ref lvalue) => { + // causes non-drop values to be dropped. + self.consume_lvalue(ContextKind::StorageDead.new(location), + ConsumeKind::Consume, + (lvalue, span), + flow_state) + } } } @@ -1112,6 +1119,7 @@ enum ContextKind { CallOperand, CallDest, Assert, + StorageDead, } impl ContextKind {