]> git.lizzy.rs Git - rust.git/blobdiff - src/librustdoc/visit_ast.rs
Unify generation of section on "All items" page with all other pages
[rust.git] / src / librustdoc / visit_ast.rs
index ca7a20bf3688a934fd2a36a937c253e8f40f0b5f..e6cef4a326ac0ac066723ed6f941224f56a7ba77 100644 (file)
@@ -164,8 +164,20 @@ fn visit_mod_contents(
         self.inside_public_path &= self.cx.tcx.visibility(def_id).is_public();
         for &i in m.item_ids {
             let item = self.cx.tcx.hir().item(i);
+            if matches!(item.kind, hir::ItemKind::Use(_, hir::UseKind::Glob)) {
+                continue;
+            }
             self.visit_item(item, None, &mut om);
         }
+        for &i in m.item_ids {
+            let item = self.cx.tcx.hir().item(i);
+            // To match the way import precedence works, visit glob imports last.
+            // Later passes in rustdoc will de-duplicate by name and kind, so if glob-
+            // imported items appear last, then they'll be the ones that get discarded.
+            if matches!(item.kind, hir::ItemKind::Use(_, hir::UseKind::Glob)) {
+                self.visit_item(item, None, &mut om);
+            }
+        }
         self.inside_public_path = orig_inside_public_path;
         om
     }
@@ -218,7 +230,7 @@ fn maybe_inline_local(
                     } else {
                         // All items need to be handled here in case someone wishes to link
                         // to them with intra-doc links
-                        self.cx.cache.access_levels.map.insert(did, AccessLevel::Public);
+                        self.cx.cache.access_levels.set_access_level(did, AccessLevel::Public);
                     }
                 }
             }