Bug on TyParam in cton_type_from_ty and print mir before creating function§

This commit is contained in:
bjorn3 2018-06-30 18:54:08 +02:00
parent 4beb931641
commit aee8d75057
2 changed files with 5 additions and 4 deletions

View File

@ -9,6 +9,10 @@ pub fn trans_mono_item<'a, 'tcx: 'a>(cx: &mut CodegenCx<'a, 'tcx, CurrentBackend
def: InstanceDef::Item(def_id),
substs,
} => {
let mut mir = ::std::io::Cursor::new(Vec::new());
::rustc_mir::util::write_mir_pretty(tcx, Some(def_id), &mut mir).unwrap();
tcx.sess.warn(&format!("{:?}:\n\n{}", def_id, String::from_utf8_lossy(&mir.into_inner())));
let sig = tcx.fn_sig(def_id);
let sig = cton_sig_from_fn_sig(tcx, sig, substs);
let func_id = {
@ -23,10 +27,6 @@ pub fn trans_mono_item<'a, 'tcx: 'a>(cx: &mut CodegenCx<'a, 'tcx, CurrentBackend
let mut f = Function::with_name_signature(ExternalName::user(0, func_id.index() as u32), sig);
let mut mir = ::std::io::Cursor::new(Vec::new());
::rustc_mir::util::write_mir_pretty(tcx, Some(def_id), &mut mir).unwrap();
tcx.sess.warn(&format!("{:?}:\n\n{}", def_id, String::from_utf8_lossy(&mir.into_inner())));
::base::trans_fn(cx, &mut f, inst);
let mut cton = String::new();

View File

@ -47,6 +47,7 @@ fn cton_type_from_ty(ty: Ty) -> Option<types::Type> {
}
TypeVariants::TyFnPtr(_) => types::I64,
TypeVariants::TyRef(..) | TypeVariants::TyRawPtr(..) => types::I64,
TypeVariants::TyParam(_) => bug!("{:?}", ty),
_ => return None,
})
}