@@ -327,6 +327,11 @@ impl<'tcx> Inliner<'tcx> {
327327 ) -> Option < CallSite < ' tcx > > {
328328 // Only consider direct calls to functions
329329 let terminator = bb_data. terminator ( ) ;
330+
331+ // FIXME(explicit_tail_calls): figure out if we can inline tail calls
332+ // (this is different from the other fixme,
333+ // this one is about tail calls in the caller,
334+ // rather than the callee)
330335 if let TerminatorKind :: Call { ref func, target, fn_span, .. } = terminator. kind {
331336 let func_ty = func. ty ( caller_body, self . tcx ) ;
332337 if let ty:: FnDef ( def_id, substs) = * func_ty. kind ( ) {
@@ -829,6 +834,13 @@ impl<'tcx> Visitor<'tcx> for CostChecker<'_, 'tcx> {
829834 self . cost += LANDINGPAD_PENALTY ;
830835 }
831836 }
837+
838+ // FIXME(explicit_tail_calls): figure out how exactly functions containing tail calls can be inlined (and if they even should)
839+ TerminatorKind :: TailCall { .. } => {
840+ self . validation = Err ( "can't inline functions with tail calls" ) ;
841+ return ;
842+ }
843+
832844 _ => self . cost += INSTR_COST ,
833845 }
834846
@@ -1078,7 +1090,8 @@ impl<'tcx> MutVisitor<'tcx> for Integrator<'_, 'tcx> {
10781090 * unwind = self . map_unwind ( * unwind) ;
10791091 }
10801092 TerminatorKind :: TailCall { .. } => {
1081- // FIXME(explicit_tail_calls): figure out how exactly tail calls are inlined
1093+ // Cost checker forbids tail calls
1094+ unreachable ! ( )
10821095 }
10831096 TerminatorKind :: Call { ref mut target, ref mut unwind, .. } => {
10841097 if let Some ( ref mut tgt) = * target {
0 commit comments