Skip to content

Commit

Permalink
Avoid ICE when pretty-printing non-local MIR item.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
solson committed Jan 26, 2017
1 parent c0d0e68 commit 8ad06af
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/librustc_mir/pretty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ pub fn write_mir_pretty<'a, 'b, 'tcx, I>(tcx: TyCtxt<'b, 'tcx, 'tcx>,
where I: Iterator<Item=DefId>, 'tcx: 'a
{
let mut first = true;
for def_id in iter {
for def_id in iter.filter(DefId::is_local) {
let mir = &tcx.item_mir(def_id);

if first {
Expand Down

0 comments on commit 8ad06af

Please sign in to comment.