Skip to content

Fix MIR unpretty on typeck failure #31915

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 27, 2016
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Fix MIR unpretty on failure conditions
  • Loading branch information
nagisa committed Feb 27, 2016
commit 1bad5d18b47f6ad76496e1902774ba9815969f3c
25 changes: 13 additions & 12 deletions src/librustc_driver/pretty.rs
Original file line number Diff line number Diff line change
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