From 91064bff99ce6d194a503e4be81b9916f2a1ff2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jana=20D=C3=B6nszelmann?= Date: Wed, 18 Feb 2026 15:12:21 +0100 Subject: [PATCH] dont enforce tails --- compiler/rustc_codegen_llvm/src/mono_item.rs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/compiler/rustc_codegen_llvm/src/mono_item.rs b/compiler/rustc_codegen_llvm/src/mono_item.rs index f7e1ca73953e..44a77f0fad7d 100644 --- a/compiler/rustc_codegen_llvm/src/mono_item.rs +++ b/compiler/rustc_codegen_llvm/src/mono_item.rs @@ -12,7 +12,7 @@ use rustc_middle::ty::layout::{FnAbiOf, HasTypingEnv, LayoutOf}; use rustc_middle::ty::{self, Instance, Ty, TypeVisitableExt}; use rustc_session::config::CrateType; -use rustc_target::callconv::FnAbi; +use rustc_target::callconv::{FnAbi, PassMode}; use rustc_target::spec::{Arch, RelocModel}; use tracing::debug; @@ -187,15 +187,22 @@ fn add_function_aliases( args.push(llvm::get_param(alias_lldecl, index)); } - start_bx.tail_call( + let call = start_bx.call( fn_ty, Some(attrs), - fn_abi, + Some(fn_abi), aliasee, &args, None, Some(aliasee_instance), ); + + match &fn_abi.ret.mode { + PassMode::Ignore | PassMode::Indirect { .. } => start_bx.ret_void(), + PassMode::Direct(_) | PassMode::Pair { .. } | PassMode::Cast { .. } => { + start_bx.ret(call) + } + } } }