From 9991fdf17a21d10df35af5a6346998de672a390e Mon Sep 17 00:00:00 2001 From: Pietro Albini Date: Sat, 30 Dec 2017 22:44:22 +0100 Subject: [PATCH] Fix nested imports not included in the save_analysis output --- src/librustc_save_analysis/dump_visitor.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/librustc_save_analysis/dump_visitor.rs b/src/librustc_save_analysis/dump_visitor.rs index ed3b8eadad74c..808bd2a22e8a2 100644 --- a/src/librustc_save_analysis/dump_visitor.rs +++ b/src/librustc_save_analysis/dump_visitor.rs @@ -1252,7 +1252,13 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> DumpVisitor<'l, 'tcx, 'll, O> { root_item: &'l ast::Item, prefix: &ast::Path) { let path = &use_tree.prefix; - let access = access_from!(self.save_ctxt, root_item); + + // The access is calculated using the current tree ID, but with the root tree's visibility + // (since nested trees don't have their own visibility). + let access = Access { + public: root_item.vis == ast::Visibility::Public, + reachable: self.save_ctxt.analysis.access_levels.is_reachable(id), + }; // The parent def id of a given use tree is always the enclosing item. let parent = self.save_ctxt.tcx.hir.opt_local_def_id(id)