This commit is contained in:
bjorn3 2018-08-16 20:09:26 +02:00
parent 65fa8eddbb
commit eb89830f21
2 changed files with 5 additions and 2 deletions

View File

@ -21,7 +21,8 @@ pub fn trans_mono_item<'a, 'tcx: 'a>(cx: &mut CodegenCx<'a, 'tcx>, mono_item: Mo
} => {
let mut mir = ::std::io::Cursor::new(Vec::new());
::rustc_mir::util::write_mir_pretty(tcx, Some(def_id), &mut mir).unwrap();
let mir_file_name = "target/out/mir/".to_string() + &format!("{:?}", def_id).replace('/', "@");
let mir_file_name =
"target/out/mir/".to_string() + &format!("{:?}", def_id).replace('/', "@");
::std::fs::write(mir_file_name, mir.into_inner()).unwrap();
let _print_guard = PrintOnPanic(format!("{:?}", inst));

View File

@ -106,7 +106,9 @@ fn trans_const_value<'a, 'tcx: 'a>(
CValue::const_val(fx, ty, bits as i128 as i64)
}
TypeVariants::TyFnDef(def_id, substs) => {
let func_ref = fx.get_function_ref(Instance::resolve(fx.tcx, ParamEnv::reveal_all(), def_id, substs).unwrap());
let func_ref = fx.get_function_ref(
Instance::resolve(fx.tcx, ParamEnv::reveal_all(), def_id, substs).unwrap(),
);
CValue::Func(func_ref, layout)
}
_ => trans_const_place(fx, const_).to_cvalue(fx),