Resolve instance for SymFn in global/naked asm

This commit is contained in:
Michael Goulet
2025-04-27 21:55:50 +00:00
parent 0eb0b8cb67
commit 3a1ee645ca
4 changed files with 72 additions and 2 deletions

View File

@@ -457,7 +457,13 @@ where
rustc_hir::InlineAsmOperand::SymFn { expr } => {
let ty = cx.tcx().typeck(item_id.owner_id).expr_ty(expr);
let instance = match ty.kind() {
&ty::FnDef(def_id, args) => Instance::new(def_id, args),
&ty::FnDef(def_id, args) => Instance::expect_resolve(
cx.tcx(),
ty::TypingEnv::fully_monomorphized(),
def_id,
args,
expr.span,
),
_ => span_bug!(*op_sp, "asm sym is not a function"),
};