From b82d2809fda9c75c5144d6ada0bc25a9f50a1bb4 Mon Sep 17 00:00:00 2001 From: Andy Russell Date: Thu, 14 Dec 2017 21:23:20 -0500 Subject: [PATCH] save-analysis: dump extern crate imports --- src/librustc_save_analysis/dump_visitor.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/librustc_save_analysis/dump_visitor.rs b/src/librustc_save_analysis/dump_visitor.rs index 08ad96c6fe8..11e2135d2de 100644 --- a/src/librustc_save_analysis/dump_visitor.rs +++ b/src/librustc_save_analysis/dump_visitor.rs @@ -1404,6 +1404,9 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> Visitor<'l> for DumpVisitor<'l, 'tc if !self.span.filter_generated(alias_span, item.span) { let span = self.span_from_span(alias_span.expect("No span found for extern crate")); + let parent = self.save_ctxt.tcx.hir.opt_local_def_id(item.id) + .and_then(|id| self.save_ctxt.tcx.parent_def_id(id)) + .map(::id_from_def_id); self.dumper.import( &Access { public: false, @@ -1415,7 +1418,7 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> Visitor<'l> for DumpVisitor<'l, 'tc span, name: item.ident.to_string(), value: String::new(), - parent: None, + parent, }, ); }