Skip to content

Commit

Permalink
Fix MIR unpretty on failure conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
nagisa committed Feb 27, 2016
1 parent f6f050d commit 1bad5d1
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions src/librustc_driver/pretty.rs
Expand Up @@ -817,13 +817,12 @@ pub fn pretty_print_input(sess: Session,
&id,
resolve::MakeGlobMap::No,
|tcx, mir_map, _, _| {
let mir_map = mir_map.unwrap();

for (nodeid, mir) in &mir_map.map {
try!(writeln!(out, "MIR for {}", tcx.map.node_to_string(*nodeid)));
try!(write_mir_pretty(mir, &mut out));
if let Some(mir_map) = mir_map {
for (nodeid, mir) in &mir_map.map {
try!(writeln!(out, "MIR for {}", tcx.map.node_to_string(*nodeid)));
try!(write_mir_pretty(mir, &mut out));
}
}

Ok(())
}), &sess)
}
Expand All @@ -840,12 +839,14 @@ pub fn pretty_print_input(sess: Session,
&id,
resolve::MakeGlobMap::No,
|tcx, mir_map, _, _| {
let mir_map = mir_map.unwrap();
try!(writeln!(out, "MIR for {}", tcx.map.node_to_string(nodeid)));
let mir = mir_map.map.get(&nodeid).unwrap_or_else(|| {
sess.fatal(&format!("no MIR map entry for node {}", nodeid))
});
write_mir_pretty(mir, &mut out)
if let Some(mir_map) = mir_map {
try!(writeln!(out, "MIR for {}", tcx.map.node_to_string(nodeid)));
let mir = mir_map.map.get(&nodeid).unwrap_or_else(|| {
sess.fatal(&format!("no MIR map entry for node {}", nodeid))
});
try!(write_mir_pretty(mir, &mut out));
}
Ok(())
}), &sess)
}

Expand Down

0 comments on commit 1bad5d1

Please sign in to comment.