1
Fork 0

Don't use write_mir_pretty for non local mir

This commit is contained in:
bjorn3 2018-09-08 17:23:03 +02:00
parent 9f489bc8de
commit 252607ae41

View file

@ -23,13 +23,16 @@ pub fn trans_mono_item<'a, 'tcx: 'a>(
match inst.def {
InstanceDef::Item(_)
| InstanceDef::DropGlue(_, _)
| InstanceDef::Virtual(_, _) => {
| InstanceDef::Virtual(_, _) if inst.def_id().krate == LOCAL_CRATE => {
let mut mir = ::std::io::Cursor::new(Vec::new());
::rustc_mir::util::write_mir_pretty(tcx, Some(inst.def_id()), &mut mir)
.unwrap();
String::from_utf8(mir.into_inner()).unwrap()
}
InstanceDef::FnPtrShim(_, _)
InstanceDef::Item(_)
| InstanceDef::DropGlue(_, _)
| InstanceDef::Virtual(_, _)
| InstanceDef::FnPtrShim(_, _)
| InstanceDef::ClosureOnceShim { .. }
| InstanceDef::CloneShim(_, _) => {
// FIXME fix write_mir_pretty for these instances