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
This commit is contained in:
Matthias Krüger 2024-08-09 00:03:37 +02:00 committed by GitHub
commit 5e388ea48e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 14 additions and 1 deletions

View File

@ -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));

View File

@ -0,0 +1,6 @@
// See https://github.com/rust-lang/rust/issues/101105
//@ !has "$.index[*][?(@.name=='nucleus')]"
mod corpus {
pub mod nucleus {}
}