about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNick Cameron <ncameron@mozilla.com>2017-11-08 09:46:06 +1300
committerNick Cameron <ncameron@mozilla.com>2017-11-08 09:46:06 +1300
commit95937990c5e772721e83c603dcca7c5aed8cdd0e (patch)
treef06ce627192dea5059b7356378ec0202c907aca6
parent7ade24f67201531778e7674b4b63ebf1a23c9643 (diff)
downloadrust-95937990c5e772721e83c603dcca7c5aed8cdd0e.tar.gz
rust-95937990c5e772721e83c603dcca7c5aed8cdd0e.zip
save-analysis: fix regression from #45709
closes https://github.com/nrc/rls-analysis/issues/117
-rw-r--r--src/librustc_save_analysis/dump_visitor.rs27
1 files changed, 16 insertions, 11 deletions
diff --git a/src/librustc_save_analysis/dump_visitor.rs b/src/librustc_save_analysis/dump_visitor.rs
index d190ae1431f..fdd7a8e8d74 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),
             }