Skip to content

Commit 84bb48f

Browse files
committed
Factor out some repeated code in build_exit_tree.
1 parent bf4532c commit 84bb48f

File tree

1 file changed

+6
-12
lines changed
  • compiler/rustc_mir_build/src/builder

1 file changed

+6
-12
lines changed

compiler/rustc_mir_build/src/builder/scope.rs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1713,28 +1713,22 @@ impl<'a, 'tcx: 'a> Builder<'a, 'tcx> {
17131713
let dropline_target = self.diverge_dropline_target(else_scope, span);
17141714
let mut dropline_indices = IndexVec::from_elem_n(dropline_target, 1);
17151715
for (drop_idx, drop_data) in drops.drop_nodes.iter_enumerated().skip(1) {
1716+
let coroutine_drop = self
1717+
.scopes
1718+
.coroutine_drops
1719+
.add_drop(drop_data.data, dropline_indices[drop_data.next]);
17161720
match drop_data.data.kind {
1717-
DropKind::Storage | DropKind::ForLint => {
1718-
let coroutine_drop = self
1719-
.scopes
1720-
.coroutine_drops
1721-
.add_drop(drop_data.data, dropline_indices[drop_data.next]);
1722-
dropline_indices.push(coroutine_drop);
1723-
}
1721+
DropKind::Storage | DropKind::ForLint => {}
17241722
DropKind::Value => {
1725-
let coroutine_drop = self
1726-
.scopes
1727-
.coroutine_drops
1728-
.add_drop(drop_data.data, dropline_indices[drop_data.next]);
17291723
if self.is_async_drop(drop_data.data.local) {
17301724
self.scopes.coroutine_drops.add_entry_point(
17311725
blocks[drop_idx].unwrap(),
17321726
dropline_indices[drop_data.next],
17331727
);
17341728
}
1735-
dropline_indices.push(coroutine_drop);
17361729
}
17371730
}
1731+
dropline_indices.push(coroutine_drop);
17381732
}
17391733
}
17401734
blocks[ROOT_NODE].map(BasicBlock::unit)

0 commit comments

Comments
 (0)