Skip to content

Commit 9593799

Browse files
committed
save-analysis: fix regression from rust-lang#45709
closes rust-dev-tools/rls-analysis#117
1 parent 7ade24f commit 9593799

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

src/librustc_save_analysis/dump_visitor.rs

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -785,21 +785,19 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> DumpVisitor<'l, 'tcx, 'll, O> {
785785
}
786786
}
787787

788+
fn dump_path_ref(&mut self, id: NodeId, path: &ast::Path) {
789+
let path_data = self.save_ctxt.get_path_data(id, path);
790+
if let Some(path_data) = path_data {
791+
self.dumper.dump_ref(path_data);
792+
}
793+
}
794+
788795
fn process_path(&mut self, id: NodeId, path: &'l ast::Path) {
789796
debug!("process_path {:?}", path);
790-
let path_data = self.save_ctxt.get_path_data(id, path);
791-
if generated_code(path.span) && path_data.is_none() {
797+
if generated_code(path.span) {
792798
return;
793799
}
794-
795-
let path_data = match path_data {
796-
Some(pd) => pd,
797-
None => {
798-
return;
799-
}
800-
};
801-
802-
self.dumper.dump_ref(path_data);
800+
self.dump_path_ref(id, path);
803801

804802
// Type parameters
805803
for seg in &path.segments {
@@ -1508,6 +1506,13 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> Visitor<'l> for DumpVisitor<'l, 'tc
15081506
});
15091507
}
15101508
}
1509+
HirDef::StructCtor(..) | HirDef::VariantCtor(..) |
1510+
HirDef::Const(..) | HirDef::AssociatedConst(..) |
1511+
HirDef::Struct(..) | HirDef::Variant(..) |
1512+
HirDef::TyAlias(..) | HirDef::AssociatedTy(..) |
1513+
HirDef::SelfTy(..) => {
1514+
self.dump_path_ref(id, &ast::Path::from_ident(sp, i));
1515+
}
15111516
def => error!("unexpected definition kind when processing collected idents: {:?}",
15121517
def),
15131518
}

0 commit comments

Comments
 (0)