@@ -368,6 +368,8 @@ impl<'tcx> Inliner<'tcx> {
368368 ) -> Option < CallSite < ' tcx > > {
369369 // Only consider direct calls to functions
370370 let terminator = bb_data. terminator ( ) ;
371+
372+ // FIXME(explicit_tail_calls): figure out if we can inline tail calls
371373 if let TerminatorKind :: Call { ref func, fn_span, .. } = terminator. kind {
372374 let func_ty = func. ty ( caller_body, self . tcx ) ;
373375 if let ty:: FnDef ( def_id, args) = * func_ty. kind ( ) {
@@ -527,6 +529,9 @@ impl<'tcx> Inliner<'tcx> {
527529 // inline-asm is detected. LLVM will still possibly do an inline later on
528530 // if the no-attribute function ends up with the same instruction set anyway.
529531 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" ) ;
530535 } else {
531536 work_list. extend ( term. successors ( ) )
532537 }
@@ -989,7 +994,8 @@ impl<'tcx> MutVisitor<'tcx> for Integrator<'_, 'tcx> {
989994 * unwind = self . map_unwind ( * unwind) ;
990995 }
991996 TerminatorKind :: TailCall { .. } => {
992- // FIXME(explicit_tail_calls): figure out how exactly tail calls are inlined
997+ // check_mir_body forbids tail calls
998+ unreachable ! ( )
993999 }
9941000 TerminatorKind :: Call { ref mut target, ref mut unwind, .. } => {
9951001 if let Some ( ref mut tgt) = * target {
0 commit comments