use rustc::hir;
-use rustc::hir::def::Def;
use rustc::mir::mono::{Linkage, Visibility};
use rustc::ty::layout::HasTyCtxt;
use std::fmt;
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(hir_id) => {
let item = cx.tcx().hir().expect_item_by_hir_id(hir_id);