@@ -226,8 +226,7 @@ impl<'b, 'tcx> ElaborateDropsCtxt<'b, 'tcx> {
226
226
227
227
fn collect_drop_flags ( & mut self )
228
228
{
229
- for bb in self . mir . all_basic_blocks ( ) {
230
- let data = self . mir . basic_block_data ( bb) ;
229
+ for ( bb, data) in self . mir . basic_blocks ( ) . iter_enumerated ( ) {
231
230
let terminator = data. terminator ( ) ;
232
231
let location = match terminator. kind {
233
232
TerminatorKind :: Drop { ref location, .. } |
@@ -263,8 +262,7 @@ impl<'b, 'tcx> ElaborateDropsCtxt<'b, 'tcx> {
263
262
264
263
fn elaborate_drops ( & mut self )
265
264
{
266
- for bb in self . mir . all_basic_blocks ( ) {
267
- let data = self . mir . basic_block_data ( bb) ;
265
+ for ( bb, data) in self . mir . basic_blocks ( ) . iter_enumerated ( ) {
268
266
let loc = Location { block : bb, index : data. statements . len ( ) } ;
269
267
let terminator = data. terminator ( ) ;
270
268
@@ -325,7 +323,7 @@ impl<'b, 'tcx> ElaborateDropsCtxt<'b, 'tcx> {
325
323
unwind : Option < BasicBlock > )
326
324
{
327
325
let bb = loc. block ;
328
- let data = self . mir . basic_block_data ( bb ) ;
326
+ let data = & self . mir [ bb ] ;
329
327
let terminator = data. terminator ( ) ;
330
328
331
329
let assign = Statement {
@@ -949,8 +947,7 @@ impl<'b, 'tcx> ElaborateDropsCtxt<'b, 'tcx> {
949
947
}
950
948
951
949
fn drop_flags_for_fn_rets ( & mut self ) {
952
- for bb in self . mir . all_basic_blocks ( ) {
953
- let data = self . mir . basic_block_data ( bb) ;
950
+ for ( bb, data) in self . mir . basic_blocks ( ) . iter_enumerated ( ) {
954
951
if let TerminatorKind :: Call {
955
952
destination : Some ( ( ref lv, tgt) ) , cleanup : Some ( _) , ..
956
953
} = data. terminator ( ) . kind {
@@ -982,8 +979,7 @@ impl<'b, 'tcx> ElaborateDropsCtxt<'b, 'tcx> {
982
979
// drop flags by themselves, to avoid the drop flags being
983
980
// clobbered before they are read.
984
981
985
- for bb in self . mir . all_basic_blocks ( ) {
986
- let data = self . mir . basic_block_data ( bb) ;
982
+ for ( bb, data) in self . mir . basic_blocks ( ) . iter_enumerated ( ) {
987
983
debug ! ( "drop_flags_for_locs({:?})" , data) ;
988
984
for i in 0 ..( data. statements . len ( ) +1 ) {
989
985
debug ! ( "drop_flag_for_locs: stmt {}" , i) ;
0 commit comments