Skip to content

Commit

Permalink
Don't strip items with inherited visibility in AliasedNonLocalStripper
Browse files Browse the repository at this point in the history
  • Loading branch information
compiler-errors committed May 20, 2024
1 parent dbfed2c commit 090dbb1
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/librustdoc/passes/strip_aliased_non_local.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,13 @@ impl<'tcx> DocFolder for NonLocalStripper<'tcx> {
// the field and not the one given by the user for the currrent crate.
//
// FIXME(#125009): Not-local should probably consider same Cargo workspace
if !i.def_id().map_or(true, |did| did.is_local()) {
if i.visibility(self.tcx) != Some(Visibility::Public) || i.is_doc_hidden() {
if let Some(def_id) = i.def_id()
&& !def_id.is_local()
{
if i.is_doc_hidden()
// Default to *not* stripping items with inherited visibility.
|| i.visibility(self.tcx).map_or(false, |viz| viz != Visibility::Public)
{
return Some(strip_item(i));
}
}
Expand Down

0 comments on commit 090dbb1

Please sign in to comment.