@@ -368,6 +368,8 @@ impl<'tcx> Inliner<'tcx> {
368
368
) -> Option < CallSite < ' tcx > > {
369
369
// Only consider direct calls to functions
370
370
let terminator = bb_data. terminator ( ) ;
371
+
372
+ // FIXME(explicit_tail_calls): figure out if we can inline tail calls
371
373
if let TerminatorKind :: Call { ref func, fn_span, .. } = terminator. kind {
372
374
let func_ty = func. ty ( caller_body, self . tcx ) ;
373
375
if let ty:: FnDef ( def_id, args) = * func_ty. kind ( ) {
@@ -527,6 +529,9 @@ impl<'tcx> Inliner<'tcx> {
527
529
// inline-asm is detected. LLVM will still possibly do an inline later on
528
530
// if the no-attribute function ends up with the same instruction set anyway.
529
531
return Err ( "Cannot move inline-asm across instruction sets" ) ;
532
+ } else if let TerminatorKind :: TailCall { .. } = term. kind {
533
+ // FIXME(explicit_tail_calls): figure out how exactly functions containing tail calls can be inlined (and if they even should)
534
+ return Err ( "can't inline functions with tail calls" ) ;
530
535
} else {
531
536
work_list. extend ( term. successors ( ) )
532
537
}
@@ -989,7 +994,8 @@ impl<'tcx> MutVisitor<'tcx> for Integrator<'_, 'tcx> {
989
994
* unwind = self . map_unwind ( * unwind) ;
990
995
}
991
996
TerminatorKind :: TailCall { .. } => {
992
- // FIXME(explicit_tail_calls): figure out how exactly tail calls are inlined
997
+ // check_mir_body forbids tail calls
998
+ unreachable ! ( )
993
999
}
994
1000
TerminatorKind :: Call { ref mut target, ref mut unwind, .. } => {
995
1001
if let Some ( ref mut tgt) = * target {
0 commit comments