Skip to content

Commit

Permalink
Rollup merge of rust-lang#39285 - nrc:save-tables, r=@eddyb
Browse files Browse the repository at this point in the history
save-analysis: get tables directly, accomodating them being missing

Fixes an ICE when running with save-analysis after an error

r? @eddyb
  • Loading branch information
alexcrichton committed Jan 28, 2017
2 parents f165861 + 36ad34d commit 666fc45
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/librustc_save_analysis/dump_visitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,16 @@ impl<'l, 'tcx: 'l, 'll, D: Dump + 'll> DumpVisitor<'l, 'tcx, 'll, D> {
fn nest_tables<F>(&mut self, item_id: NodeId, f: F)
where F: FnOnce(&mut DumpVisitor<'l, 'tcx, 'll, D>)
{
let old_tables = self.save_ctxt.tables;
let item_def_id = self.tcx.hir.local_def_id(item_id);
self.save_ctxt.tables = self.tcx.item_tables(item_def_id);
f(self);
self.save_ctxt.tables = old_tables;
match self.tcx.tables.borrow().get(&item_def_id) {
Some(tables) => {
let old_tables = self.save_ctxt.tables;
self.save_ctxt.tables = tables;
f(self);
self.save_ctxt.tables = old_tables;
}
None => f(self),
}
}

pub fn dump_crate_info(&mut self, name: &str, krate: &ast::Crate) {
Expand Down

0 comments on commit 666fc45

Please sign in to comment.