]> git.lizzy.rs Git - rust.git/commitdiff
Use an ItemId inside mir::GlobalAsm.
authorCamille GILLOT <gillot.camille@gmail.com>
Sat, 30 Jan 2021 18:18:48 +0000 (19:18 +0100)
committerCamille GILLOT <gillot.camille@gmail.com>
Mon, 15 Feb 2021 18:24:58 +0000 (19:24 +0100)
src/driver/aot.rs
src/driver/jit.rs

index df89883f0bbb7418df249bbba4a8f04e3e191171..c9e503a43b9e1014f41ccdf207e2b02e79085d6f 100644 (file)
@@ -164,8 +164,8 @@ fn module_codegen(tcx: TyCtxt<'_>, cgu_name: rustc_span::Symbol) -> ModuleCodege
             MonoItem::Static(def_id) => {
                 crate::constant::codegen_static(&mut cx.constants_cx, def_id)
             }
-            MonoItem::GlobalAsm(hir_id) => {
-                let item = cx.tcx.hir().expect_item(hir_id);
+            MonoItem::GlobalAsm(item_id) => {
+                let item = cx.tcx.hir().item(item_id);
                 if let rustc_hir::ItemKind::GlobalAsm(rustc_hir::GlobalAsm { asm }) = item.kind {
                     cx.global_asm.push_str(&*asm.as_str());
                     cx.global_asm.push_str("\n\n");
index 2d14ff2c0221d19c868dea6be771dd18106ff136..f784d8d27cc7423de24c787030cf680637214ec4 100644 (file)
@@ -93,10 +93,9 @@ pub(super) fn run_jit(tcx: TyCtxt<'_>, codegen_mode: CodegenMode) -> ! {
                 MonoItem::Static(def_id) => {
                     crate::constant::codegen_static(&mut cx.constants_cx, def_id);
                 }
-                MonoItem::GlobalAsm(hir_id) => {
-                    let item = cx.tcx.hir().expect_item(hir_id);
-                    tcx.sess
-                        .span_fatal(item.span, "Global asm is not supported in JIT mode");
+                MonoItem::GlobalAsm(item_id) => {
+                    let item = cx.tcx.hir().item(item_id);
+                    tcx.sess.span_fatal(item.span, "Global asm is not supported in JIT mode");
                 }
             }
         }