]> git.lizzy.rs Git - rust.git/commitdiff
Fix nested imports not included in the save_analysis output
authorPietro Albini <pietro@pietroalbini.org>
Sat, 30 Dec 2017 21:44:22 +0000 (22:44 +0100)
committerPietro Albini <pietro@pietroalbini.org>
Sat, 30 Dec 2017 21:55:59 +0000 (22:55 +0100)
src/librustc_save_analysis/dump_visitor.rs

index ed3b8eadad74c6c4b4d6abb7b33f7fa98bb016d9..808bd2a22e8a2ef03ba3fef45bfa66580dac9cf7 100644 (file)
@@ -1252,7 +1252,13 @@ fn process_use_tree(&mut self,
                          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)