From 95937990c5e772721e83c603dcca7c5aed8cdd0e Mon Sep 17 00:00:00 2001 From: Nick Cameron Date: Wed, 8 Nov 2017 09:46:06 +1300 Subject: [PATCH] save-analysis: fix regression from #45709 closes https://github.com/nrc/rls-analysis/issues/117 --- src/librustc_save_analysis/dump_visitor.rs | 27 +++++++++++++--------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/src/librustc_save_analysis/dump_visitor.rs b/src/librustc_save_analysis/dump_visitor.rs index d190ae1431fd..fdd7a8e8d74f 100644 --- a/src/librustc_save_analysis/dump_visitor.rs +++ b/src/librustc_save_analysis/dump_visitor.rs @@ -785,21 +785,19 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> DumpVisitor<'l, 'tcx, 'll, O> { } } + fn dump_path_ref(&mut self, id: NodeId, path: &ast::Path) { + let path_data = self.save_ctxt.get_path_data(id, path); + if let Some(path_data) = path_data { + self.dumper.dump_ref(path_data); + } + } + fn process_path(&mut self, id: NodeId, path: &'l ast::Path) { debug!("process_path {:?}", path); - let path_data = self.save_ctxt.get_path_data(id, path); - if generated_code(path.span) && path_data.is_none() { + if generated_code(path.span) { return; } - - let path_data = match path_data { - Some(pd) => pd, - None => { - return; - } - }; - - self.dumper.dump_ref(path_data); + self.dump_path_ref(id, path); // Type parameters for seg in &path.segments { @@ -1508,6 +1506,13 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> Visitor<'l> for DumpVisitor<'l, 'tc }); } } + HirDef::StructCtor(..) | HirDef::VariantCtor(..) | + HirDef::Const(..) | HirDef::AssociatedConst(..) | + HirDef::Struct(..) | HirDef::Variant(..) | + HirDef::TyAlias(..) | HirDef::AssociatedTy(..) | + HirDef::SelfTy(..) => { + self.dump_path_ref(id, &ast::Path::from_ident(sp, i)); + } def => error!("unexpected definition kind when processing collected idents: {:?}", def), }