@@ -80,7 +80,7 @@ impl<'tcx> crate::MirPass<'tcx> for Validator {
80
80
cfg_checker. fail ( location, msg) ;
81
81
}
82
82
83
- if let MirPhase :: Runtime ( phase ) = body. phase {
83
+ if let MirPhase :: Runtime ( _ ) = body. phase {
84
84
if let ty:: InstanceKind :: Item ( _) = body. source . instance {
85
85
if body. has_free_regions ( ) {
86
86
cfg_checker. fail (
@@ -89,27 +89,6 @@ impl<'tcx> crate::MirPass<'tcx> for Validator {
89
89
) ;
90
90
}
91
91
}
92
-
93
- if phase >= RuntimePhase :: Optimized
94
- && body
95
- . basic_blocks
96
- . iter ( )
97
- . filter_map ( |bb| match & bb. terminator ( ) . kind {
98
- TerminatorKind :: Call { func, .. }
99
- | TerminatorKind :: TailCall { func, .. } => Some ( func) ,
100
- _ => None ,
101
- } )
102
- . filter_map ( |func| match func. ty ( & body. local_decls , tcx) . kind ( ) {
103
- ty:: FnDef ( did, ..) => Some ( did) ,
104
- _ => None ,
105
- } )
106
- . any ( |did| matches ! ( tcx. codegen_fn_attrs( did) . inline, InlineAttr :: Force { .. } ) )
107
- {
108
- cfg_checker. fail (
109
- Location :: START ,
110
- "`#[rustc_force_inline]`-annotated function not inlined" ,
111
- ) ;
112
- }
113
92
}
114
93
}
115
94
}
@@ -388,7 +367,8 @@ impl<'a, 'tcx> Visitor<'tcx> for CfgChecker<'a, 'tcx> {
388
367
self . check_edge ( location, * target, EdgeKind :: Normal ) ;
389
368
self . check_unwind_edge ( location, * unwind) ;
390
369
}
391
- TerminatorKind :: Call { args, .. } | TerminatorKind :: TailCall { args, .. } => {
370
+ TerminatorKind :: Call { func, args, .. }
371
+ | TerminatorKind :: TailCall { func, args, .. } => {
392
372
// FIXME(explicit_tail_calls): refactor this & add tail-call specific checks
393
373
if let TerminatorKind :: Call { target, unwind, destination, .. } = terminator. kind {
394
374
if let Some ( target) = target {
@@ -441,6 +421,13 @@ impl<'a, 'tcx> Visitor<'tcx> for CfgChecker<'a, 'tcx> {
441
421
}
442
422
}
443
423
}
424
+
425
+ if let ty:: FnDef ( did, ..) = func. ty ( & self . body . local_decls , self . tcx ) . kind ( )
426
+ && self . body . phase >= MirPhase :: Runtime ( RuntimePhase :: Optimized )
427
+ && matches ! ( self . tcx. codegen_fn_attrs( did) . inline, InlineAttr :: Force { .. } )
428
+ {
429
+ self . fail ( location, "`#[rustc_force_inline]`-annotated function not inlined" ) ;
430
+ }
444
431
}
445
432
TerminatorKind :: Assert { target, unwind, .. } => {
446
433
self . check_edge ( location, * target, EdgeKind :: Normal ) ;
0 commit comments