Bug on TyParam in cton_type_from_ty and print mir before creating function§
This commit is contained in:
parent
4beb931641
commit
aee8d75057
@ -9,6 +9,10 @@ pub fn trans_mono_item<'a, 'tcx: 'a>(cx: &mut CodegenCx<'a, 'tcx, CurrentBackend
|
|||||||
def: InstanceDef::Item(def_id),
|
def: InstanceDef::Item(def_id),
|
||||||
substs,
|
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 = tcx.fn_sig(def_id);
|
||||||
let sig = cton_sig_from_fn_sig(tcx, sig, substs);
|
let sig = cton_sig_from_fn_sig(tcx, sig, substs);
|
||||||
let func_id = {
|
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 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);
|
::base::trans_fn(cx, &mut f, inst);
|
||||||
|
|
||||||
let mut cton = String::new();
|
let mut cton = String::new();
|
||||||
|
@ -47,6 +47,7 @@ fn cton_type_from_ty(ty: Ty) -> Option<types::Type> {
|
|||||||
}
|
}
|
||||||
TypeVariants::TyFnPtr(_) => types::I64,
|
TypeVariants::TyFnPtr(_) => types::I64,
|
||||||
TypeVariants::TyRef(..) | TypeVariants::TyRawPtr(..) => types::I64,
|
TypeVariants::TyRef(..) | TypeVariants::TyRawPtr(..) => types::I64,
|
||||||
|
TypeVariants::TyParam(_) => bug!("{:?}", ty),
|
||||||
_ => return None,
|
_ => return None,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user