From 9978261a6e38ca3583cdf3eb2956cb4d14cd5a6f Mon Sep 17 00:00:00 2001 From: Maybe Waffle Date: Thu, 15 Feb 2024 19:54:37 +0000 Subject: [PATCH] Support tail calls in mir via `TerminatorKind::TailCall` --- src/base.rs | 5 +++++ src/constant.rs | 1 + 2 files changed, 6 insertions(+) diff --git a/src/base.rs b/src/base.rs index c5b4277015a..5adbbb09ac8 100644 --- a/src/base.rs +++ b/src/base.rs @@ -491,6 +491,11 @@ fn codegen_fn_body(fx: &mut FunctionCx<'_, '_, '_>, start_block: Block) { ) }); } + // FIXME(explicit_tail_calls): add support for tail calls to the cranelift backend, once cranelift supports tail calls + TerminatorKind::TailCall { fn_span, .. } => span_bug!( + *fn_span, + "tail calls are not yet supported in `rustc_codegen_cranelift` backend" + ), TerminatorKind::InlineAsm { template, operands, diff --git a/src/constant.rs b/src/constant.rs index 87c5da3b7c3..fc12f0ff738 100644 --- a/src/constant.rs +++ b/src/constant.rs @@ -565,6 +565,7 @@ pub(crate) fn mir_operand_get_const_val<'tcx>( { return None; } + TerminatorKind::TailCall { .. } => return None, TerminatorKind::Call { .. } => {} } }