Skip to content

Commit

Permalink
Unrolled build for rust-lang#128834
Browse files Browse the repository at this point in the history
Rollup merge of rust-lang#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 rust-lang#101105
  • Loading branch information
rust-timer authored Aug 9, 2024
2 parents c7b0d4e + c2a0d9c commit dcb277a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/librustdoc/passes/stripper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
6 changes: 6 additions & 0 deletions tests/rustdoc-json/pub_mod_in_private_mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// See https://github.com/rust-lang/rust/issues/101105

//@ !has "$.index[*][?(@.name=='nucleus')]"
mod corpus {
pub mod nucleus {}
}

0 comments on commit dcb277a

Please sign in to comment.