about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-08-09 00:03:37 +0200
committerGitHub <noreply@github.com>2024-08-09 00:03:37 +0200
commit5e388ea48e17a245b4113fe56bf6832caecb6d9e (patch)
tree852326c8f4f256b9b7a5f47f7d0a37dae160fd3d /src
parent5f0461707a10a2d5c9c90bf3bdb7c51f772515b9 (diff)
parentc2a0d9ca6eccbfaf1c6cd189dca0216a0ac66c75 (diff)
downloadrust-5e388ea48e17a245b4113fe56bf6832caecb6d9e.tar.gz
rust-5e388ea48e17a245b4113fe56bf6832caecb6d9e.zip
Rollup merge of #128834 - its-the-shrimp:fix_101105, r=aDotInTheVoid
rustdoc: strip unreachable modules

Modules are now stripped based on the same logic that's used to strip other item kinds
Fixes #101105
Diffstat (limited to 'src')
-rw-r--r--src/librustdoc/passes/stripper.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/librustdoc/passes/stripper.rs b/src/librustdoc/passes/stripper.rs
index d1e2b9978f7..f807c3362c4 100644
--- a/src/librustdoc/passes/stripper.rs
+++ b/src/librustdoc/passes/stripper.rs
@@ -95,7 +95,14 @@ impl<'a, 'tcx> DocFolder for Stripper<'a, 'tcx> {
             }
 
             clean::ModuleItem(..) => {
-                if i.item_id.is_local() && i.visibility(self.tcx) != Some(Visibility::Public) {
+                if i.item_id.is_local()
+                    && !is_item_reachable(
+                        self.tcx,
+                        self.is_json_output,
+                        self.effective_visibilities,
+                        i.item_id,
+                    )
+                {
                     debug!("Stripper: stripping module {:?}", i.name);
                     let old = mem::replace(&mut self.update_retained, false);
                     let ret = strip_item(self.fold_item_recur(i));