From 252607ae41f93b65ea305e79719231e8b454dc43 Mon Sep 17 00:00:00 2001 From: bjorn3 Date: Sat, 8 Sep 2018 17:23:03 +0200 Subject: [PATCH] Don't use write_mir_pretty for non local mir --- src/base.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/base.rs b/src/base.rs index 7293649d0527..dd0aaeaaedb7 100644 --- a/src/base.rs +++ b/src/base.rs @@ -23,17 +23,20 @@ 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 - format!("{:#?}", tcx.instance_mir(inst.def)) + // FIXME fix write_mir_pretty for these instances + format!("{:#?}", tcx.instance_mir(inst.def)) } InstanceDef::Intrinsic(_) => bug!("tried to codegen intrinsic"), }