about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2025-02-17 16:09:46 +0000
committerMichael Goulet <michael@errs.io>2025-02-22 00:12:07 +0000
commitea760dd09911d5bd73fd8a4321f319620e0cc53a (patch)
tree47f43740defe2f77c02f025d74f03fdfb3fda661
parent9dd86e64cc19d24d5e62a028cae4515a1fbe95c2 (diff)
downloadrust-ea760dd09911d5bd73fd8a4321f319620e0cc53a.tar.gz
rust-ea760dd09911d5bd73fd8a4321f319620e0cc53a.zip
Make a fake body to store typeck results for global_asm
-rw-r--r--src/global_asm.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/global_asm.rs b/src/global_asm.rs
index 0a23f63d6ba..9ea92c300f8 100644
--- a/src/global_asm.rs
+++ b/src/global_asm.rs
@@ -16,7 +16,7 @@ use crate::prelude::*;
 
 pub(crate) fn codegen_global_asm_item(tcx: TyCtxt<'_>, global_asm: &mut String, item_id: ItemId) {
     let item = tcx.hir_item(item_id);
-    if let rustc_hir::ItemKind::GlobalAsm { asm } = item.kind {
+    if let rustc_hir::ItemKind::GlobalAsm { asm, .. } = item.kind {
         let is_x86 =
             matches!(tcx.sess.asm_arch.unwrap(), InlineAsmArch::X86 | InlineAsmArch::X86_64);
 
@@ -55,7 +55,7 @@ pub(crate) fn codegen_global_asm_item(tcx: TyCtxt<'_>, global_asm: &mut String,
                                 }
                             }
                         }
-                        InlineAsmOperand::SymFn { anon_const } => {
+                        InlineAsmOperand::SymFn { expr } => {
                             if cfg!(not(feature = "inline_asm_sym")) {
                                 tcx.dcx().span_err(
                                     item.span,
@@ -63,7 +63,7 @@ pub(crate) fn codegen_global_asm_item(tcx: TyCtxt<'_>, global_asm: &mut String,
                                 );
                             }
 
-                            let ty = tcx.typeck_body(anon_const.body).node_type(anon_const.hir_id);
+                            let ty = tcx.typeck(item_id.owner_id).expr_ty(expr);
                             let instance = match ty.kind() {
                                 &ty::FnDef(def_id, args) => Instance::new(def_id, args),
                                 _ => span_bug!(op_sp, "asm sym is not a function"),