diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2025-05-21 05:48:40 +1000 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2025-05-27 09:28:39 +1000 |
| commit | 84bb48fc886d5de72c86fb56c11f8586ca465647 (patch) | |
| tree | 9d579ff4be5bcb682c37374de8dafc939e11b0c2 | |
| parent | bf4532c05d2537c091de6787b8bb80e2cd24cd63 (diff) | |
| download | rust-84bb48fc886d5de72c86fb56c11f8586ca465647.tar.gz rust-84bb48fc886d5de72c86fb56c11f8586ca465647.zip | |
Factor out some repeated code in `build_exit_tree`.
| -rw-r--r-- | compiler/rustc_mir_build/src/builder/scope.rs | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/compiler/rustc_mir_build/src/builder/scope.rs b/compiler/rustc_mir_build/src/builder/scope.rs index d7900cb0845..28d72f73155 100644 --- a/compiler/rustc_mir_build/src/builder/scope.rs +++ b/compiler/rustc_mir_build/src/builder/scope.rs @@ -1713,28 +1713,22 @@ impl<'a, 'tcx: 'a> Builder<'a, 'tcx> { let dropline_target = self.diverge_dropline_target(else_scope, span); let mut dropline_indices = IndexVec::from_elem_n(dropline_target, 1); for (drop_idx, drop_data) in drops.drop_nodes.iter_enumerated().skip(1) { + let coroutine_drop = self + .scopes + .coroutine_drops + .add_drop(drop_data.data, dropline_indices[drop_data.next]); match drop_data.data.kind { - DropKind::Storage | DropKind::ForLint => { - let coroutine_drop = self - .scopes - .coroutine_drops - .add_drop(drop_data.data, dropline_indices[drop_data.next]); - dropline_indices.push(coroutine_drop); - } + DropKind::Storage | DropKind::ForLint => {} DropKind::Value => { - let coroutine_drop = self - .scopes - .coroutine_drops - .add_drop(drop_data.data, dropline_indices[drop_data.next]); if self.is_async_drop(drop_data.data.local) { self.scopes.coroutine_drops.add_entry_point( blocks[drop_idx].unwrap(), dropline_indices[drop_data.next], ); } - dropline_indices.push(coroutine_drop); } } + dropline_indices.push(coroutine_drop); } } blocks[ROOT_NODE].map(BasicBlock::unit) |
