Skip to content

Commit ea760dd

Browse files
Make a fake body to store typeck results for global_asm
1 parent 9dd86e6 commit ea760dd

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/global_asm.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use crate::prelude::*;
1616

1717
pub(crate) fn codegen_global_asm_item(tcx: TyCtxt<'_>, global_asm: &mut String, item_id: ItemId) {
1818
let item = tcx.hir_item(item_id);
19-
if let rustc_hir::ItemKind::GlobalAsm { asm } = item.kind {
19+
if let rustc_hir::ItemKind::GlobalAsm { asm, .. } = item.kind {
2020
let is_x86 =
2121
matches!(tcx.sess.asm_arch.unwrap(), InlineAsmArch::X86 | InlineAsmArch::X86_64);
2222

@@ -55,15 +55,15 @@ pub(crate) fn codegen_global_asm_item(tcx: TyCtxt<'_>, global_asm: &mut String,
5555
}
5656
}
5757
}
58-
InlineAsmOperand::SymFn { anon_const } => {
58+
InlineAsmOperand::SymFn { expr } => {
5959
if cfg!(not(feature = "inline_asm_sym")) {
6060
tcx.dcx().span_err(
6161
item.span,
6262
"asm! and global_asm! sym operands are not yet supported",
6363
);
6464
}
6565

66-
let ty = tcx.typeck_body(anon_const.body).node_type(anon_const.hir_id);
66+
let ty = tcx.typeck(item_id.owner_id).expr_ty(expr);
6767
let instance = match ty.kind() {
6868
&ty::FnDef(def_id, args) => Instance::new(def_id, args),
6969
_ => span_bug!(op_sp, "asm sym is not a function"),

0 commit comments

Comments
 (0)