Skip to content

Commit 6d6280e

Browse files
committed
Address review comment: StatementKind::StorageDead has an effect (running dtors) relevant to borrowck.
1 parent b6528f0 commit 6d6280e

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/librustc_mir/transform/borrow_check.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,10 +222,17 @@ impl<'c, 'b, 'a: 'b+'c, 'gcx, 'tcx: 'a> DataflowResultsConsumer<'b, 'gcx>
222222
}
223223
StatementKind::Nop |
224224
StatementKind::Validate(..) |
225-
StatementKind::StorageLive(..) |
226-
StatementKind::StorageDead(..) => {
225+
StatementKind::StorageLive(..) => {
227226
// ignored by borrowck
228227
}
228+
229+
StatementKind::StorageDead(ref lvalue) => {
230+
// causes non-drop values to be dropped.
231+
self.consume_lvalue(ContextKind::StorageDead.new(location),
232+
ConsumeKind::Consume,
233+
(lvalue, span),
234+
flow_state)
235+
}
229236
}
230237
}
231238

@@ -1112,6 +1119,7 @@ enum ContextKind {
11121119
CallOperand,
11131120
CallDest,
11141121
Assert,
1122+
StorageDead,
11151123
}
11161124

11171125
impl ContextKind {

0 commit comments

Comments
 (0)