diff options
| author | Felix S. Klock II <pnkfelix@pnkfx.org> | 2017-08-14 14:42:17 +0200 |
|---|---|---|
| committer | Felix S. Klock II <pnkfelix@pnkfx.org> | 2017-08-16 16:08:39 +0200 |
| commit | 6d6280e00c302ee24730027ba36c7aabc7094cbd (patch) | |
| tree | 47af1196222d7c50d23010496e0692d06e7bab1c | |
| parent | b6528f073fcf5ed08502242eb1be18a2d07280bb (diff) | |
| download | rust-6d6280e00c302ee24730027ba36c7aabc7094cbd.tar.gz rust-6d6280e00c302ee24730027ba36c7aabc7094cbd.zip | |
Address review comment: `StatementKind::StorageDead` has an effect (running dtors) relevant to borrowck.
| -rw-r--r-- | src/librustc_mir/transform/borrow_check.rs | 12 |
1 files changed, 10 insertions, 2 deletions
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 { |
