diff options
| author | Michael Goulet <michael@errs.io> | 2025-02-17 16:09:46 +0000 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2025-02-22 00:12:07 +0000 |
| commit | 6ba39f7dc709a90bcb125974964a7e464ed86ff2 (patch) | |
| tree | 68d6c9515988454516ca2373683f87d01b890c9f /compiler/rustc_codegen_cranelift/src | |
| parent | 37060aae13d0fe771f9d3222f1c644820a9d2837 (diff) | |
| download | rust-6ba39f7dc709a90bcb125974964a7e464ed86ff2.tar.gz rust-6ba39f7dc709a90bcb125974964a7e464ed86ff2.zip | |
Make a fake body to store typeck results for global_asm
Diffstat (limited to 'compiler/rustc_codegen_cranelift/src')
| -rw-r--r-- | compiler/rustc_codegen_cranelift/src/global_asm.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/compiler/rustc_codegen_cranelift/src/global_asm.rs b/compiler/rustc_codegen_cranelift/src/global_asm.rs index 0a23f63d6ba..9ea92c300f8 100644 --- a/compiler/rustc_codegen_cranelift/src/global_asm.rs +++ b/compiler/rustc_codegen_cranelift/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"), |
