@@ -3,7 +3,7 @@ use rustc_hir::def_id::{DefId, LocalDefId};
3
3
use rustc_hir:: intravisit:: FnKind ;
4
4
use rustc_index:: vec:: IndexVec ;
5
5
use rustc_middle:: hir:: map:: blocks:: FnLikeNode ;
6
- use rustc_middle:: mir:: { BasicBlock , Body , TerminatorKind , START_BLOCK } ;
6
+ use rustc_middle:: mir:: { self , BasicBlock , Body , TerminatorKind , START_BLOCK } ;
7
7
use rustc_middle:: ty:: subst:: InternalSubsts ;
8
8
use rustc_middle:: ty:: { self , AssocItem , AssocItemContainer , Instance , TyCtxt } ;
9
9
use rustc_session:: lint:: builtin:: UNCONDITIONAL_RECURSION ;
@@ -433,7 +433,11 @@ fn collect_outgoing_calls<'a, 'tcx>(
433
433
tcx : TyCtxt < ' tcx > ,
434
434
body : & ' a Body < ' tcx > ,
435
435
) -> impl Iterator < Item = ( BasicBlock , Callee < ' tcx > , Span ) > + ' a {
436
- body. basic_blocks ( ) . iter_enumerated ( ) . filter_map ( move |( bb, data) | {
436
+ mir:: traversal:: preorder ( body) . filter_map ( move |( bb, data) | {
437
+ if data. is_cleanup {
438
+ return None ;
439
+ }
440
+
437
441
if let TerminatorKind :: Call { func, .. } = & data. terminator ( ) . kind {
438
442
let func_ty = func. ty ( body, tcx) ;
439
443
if let ty:: FnDef ( def_id, substs) = func_ty. kind {
0 commit comments