Skip to content

Commit fbdac30

Browse files
committed
Rename DropTree::add_entry to add_entry_point
This clarifies that we're adding an "entry point", not just adding an "entry" of some kind.
1 parent 3bd8df9 commit fbdac30

File tree

1 file changed

+14
-9
lines changed
  • compiler/rustc_mir_build/src/build

1 file changed

+14
-9
lines changed

compiler/rustc_mir_build/src/build/scope.rs

+14-9
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,11 @@ impl DropTree {
271271
.or_insert_with(|| drops.push((drop, next)))
272272
}
273273

274-
fn add_entry(&mut self, from: BasicBlock, to: DropIdx) {
274+
/// Registers `from` as an entry point to this drop tree, at `to`.
275+
///
276+
/// During [`Self::build_mir`], `from` will be linked to the corresponding
277+
/// block within the drop tree.
278+
fn add_entry_point(&mut self, from: BasicBlock, to: DropIdx) {
275279
debug_assert!(to < self.drops.next_index());
276280
self.entry_points.push((to, from));
277281
}
@@ -673,7 +677,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
673677
.flat_map(|scope| &scope.drops)
674678
.fold(ROOT_NODE, |drop_idx, &drop| drops.add_drop(drop, drop_idx));
675679

676-
drops.add_entry(block, drop_idx);
680+
drops.add_entry_point(block, drop_idx);
677681

678682
// `build_drop_trees` doesn't have access to our source_info, so we
679683
// create a dummy terminator now. `TerminatorKind::UnwindResume` is used
@@ -706,7 +710,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
706710
drop_idx = drops.add_drop(*drop, drop_idx);
707711
}
708712
}
709-
drops.add_entry(block, drop_idx);
713+
drops.add_entry_point(block, drop_idx);
710714

711715
// `build_drop_trees` doesn't have access to our source_info, so we
712716
// create a dummy terminator now. `TerminatorKind::UnwindResume` is used
@@ -1118,7 +1122,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
11181122
);
11191123

11201124
let next_drop = self.diverge_cleanup();
1121-
self.scopes.unwind_drops.add_entry(start, next_drop);
1125+
self.scopes.unwind_drops.add_entry_point(start, next_drop);
11221126
}
11231127

11241128
/// Sets up a path that performs all required cleanup for dropping a
@@ -1152,7 +1156,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
11521156
scope.cached_coroutine_drop_block = Some(cached_drop);
11531157
}
11541158

1155-
self.scopes.coroutine_drops.add_entry(yield_block, cached_drop);
1159+
self.scopes.coroutine_drops.add_entry_point(yield_block, cached_drop);
11561160
}
11571161

11581162
/// Utility function for *non*-scope code to build their own drops
@@ -1285,7 +1289,7 @@ fn build_scope_drops<'tcx>(
12851289
continue;
12861290
}
12871291

1288-
unwind_drops.add_entry(block, unwind_to);
1292+
unwind_drops.add_entry_point(block, unwind_to);
12891293

12901294
let next = cfg.start_new_block();
12911295
cfg.terminate(
@@ -1355,9 +1359,10 @@ impl<'a, 'tcx: 'a> Builder<'a, 'tcx> {
13551359
.scopes
13561360
.unwind_drops
13571361
.add_drop(drop_data.0, unwind_indices[drop_data.1]);
1358-
self.scopes
1359-
.unwind_drops
1360-
.add_entry(blocks[drop_idx].unwrap(), unwind_indices[drop_data.1]);
1362+
self.scopes.unwind_drops.add_entry_point(
1363+
blocks[drop_idx].unwrap(),
1364+
unwind_indices[drop_data.1],
1365+
);
13611366
unwind_indices.push(unwind_drop);
13621367
}
13631368
}

0 commit comments

Comments
 (0)