@@ -271,7 +271,11 @@ impl DropTree {
271
271
. or_insert_with ( || drops. push ( ( drop, next) ) )
272
272
}
273
273
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 ) {
275
279
debug_assert ! ( to < self . drops. next_index( ) ) ;
276
280
self . entry_points . push ( ( to, from) ) ;
277
281
}
@@ -673,7 +677,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
673
677
. flat_map ( |scope| & scope. drops )
674
678
. fold ( ROOT_NODE , |drop_idx, & drop| drops. add_drop ( drop, drop_idx) ) ;
675
679
676
- drops. add_entry ( block, drop_idx) ;
680
+ drops. add_entry_point ( block, drop_idx) ;
677
681
678
682
// `build_drop_trees` doesn't have access to our source_info, so we
679
683
// create a dummy terminator now. `TerminatorKind::UnwindResume` is used
@@ -706,7 +710,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
706
710
drop_idx = drops. add_drop ( * drop, drop_idx) ;
707
711
}
708
712
}
709
- drops. add_entry ( block, drop_idx) ;
713
+ drops. add_entry_point ( block, drop_idx) ;
710
714
711
715
// `build_drop_trees` doesn't have access to our source_info, so we
712
716
// create a dummy terminator now. `TerminatorKind::UnwindResume` is used
@@ -1118,7 +1122,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
1118
1122
) ;
1119
1123
1120
1124
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) ;
1122
1126
}
1123
1127
1124
1128
/// Sets up a path that performs all required cleanup for dropping a
@@ -1152,7 +1156,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
1152
1156
scope. cached_coroutine_drop_block = Some ( cached_drop) ;
1153
1157
}
1154
1158
1155
- self . scopes . coroutine_drops . add_entry ( yield_block, cached_drop) ;
1159
+ self . scopes . coroutine_drops . add_entry_point ( yield_block, cached_drop) ;
1156
1160
}
1157
1161
1158
1162
/// Utility function for *non*-scope code to build their own drops
@@ -1285,7 +1289,7 @@ fn build_scope_drops<'tcx>(
1285
1289
continue ;
1286
1290
}
1287
1291
1288
- unwind_drops. add_entry ( block, unwind_to) ;
1292
+ unwind_drops. add_entry_point ( block, unwind_to) ;
1289
1293
1290
1294
let next = cfg. start_new_block ( ) ;
1291
1295
cfg. terminate (
@@ -1355,9 +1359,10 @@ impl<'a, 'tcx: 'a> Builder<'a, 'tcx> {
1355
1359
. scopes
1356
1360
. unwind_drops
1357
1361
. 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
+ ) ;
1361
1366
unwind_indices. push ( unwind_drop) ;
1362
1367
}
1363
1368
}
0 commit comments