Skip to content

Commit 8ad06af

Browse files
committed
Avoid ICE when pretty-printing non-local MIR item.
This comes up when using `-Zunstable-options --unpretty=mir`. Previously, rustc would ICE due to an unwrap later in this function (after `as_local_node_id`). Instead, we should just ignore items from other crates when pretty-printing MIR.
1 parent c0d0e68 commit 8ad06af

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/librustc_mir/pretty.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ pub fn write_mir_pretty<'a, 'b, 'tcx, I>(tcx: TyCtxt<'b, 'tcx, 'tcx>,
9292
where I: Iterator<Item=DefId>, 'tcx: 'a
9393
{
9494
let mut first = true;
95-
for def_id in iter {
95+
for def_id in iter.filter(DefId::is_local) {
9696
let mir = &tcx.item_mir(def_id);
9797

9898
if first {

0 commit comments

Comments
 (0)