mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-26 00:34:06 +00:00
Rollup merge of #39285 - nrc:save-tables, r=@eddyb
save-analysis: get tables directly, accomodating them being missing Fixes an ICE when running with save-analysis after an error r? @eddyb
This commit is contained in:
commit
666fc45289
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user