]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_codegen_ssa/mono_item.rs
Auto merge of #61212 - alexcrichton:skip-rustc, r=pietroalbini
[rust.git] / src / librustc_codegen_ssa / mono_item.rs
index bfb6a9153809a8ea4f951cdf4cd0f7ce018d66d3..60d75480e61a65365dc5129f5e6f58b4534406fd 100644 (file)
@@ -1,5 +1,4 @@
 use rustc::hir;
-use rustc::hir::def::Def;
 use rustc::mir::mono::{Linkage, Visibility};
 use rustc::ty::layout::HasTyCtxt;
 use std::fmt;
@@ -19,20 +18,10 @@ fn define<Bx: BuilderMethods<'a, 'tcx>>(&self, cx: &'a Bx::CodegenCx) {
 
         match *self.as_mono_item() {
             MonoItem::Static(def_id) => {
-                let tcx = cx.tcx();
-                let is_mutable = match tcx.describe_def(def_id) {
-                    Some(Def::Static(_, is_mutable)) => is_mutable,
-                    Some(other) => {
-                        bug!("Expected Def::Static, found {:?}", other)
-                    }
-                    None => {
-                        bug!("Expected Def::Static for {:?}, found nothing", def_id)
-                    }
-                };
-                cx.codegen_static(def_id, is_mutable);
+                cx.codegen_static(def_id, cx.tcx().is_mutable_static(def_id));
             }
-            MonoItem::GlobalAsm(node_id) => {
-                let item = cx.tcx().hir().expect_item(node_id);
+            MonoItem::GlobalAsm(hir_id) => {
+                let item = cx.tcx().hir().expect_item_by_hir_id(hir_id);
                 if let hir::ItemKind::GlobalAsm(ref ga) = item.node {
                     cx.codegen_global_asm(ga);
                 } else {