diff options
| author | Michael Goulet <michael@errs.io> | 2024-05-19 20:12:56 -0400 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2024-05-19 20:13:18 -0400 |
| commit | 090dbb12f90a3d22183a7250ccad080a8e6d706c (patch) | |
| tree | 74f6e8c0feee1b95e6ff5c5955eb285034526c73 | |
| parent | dbfed2c43ec0ceb6c8215786917fc49af5cf511c (diff) | |
| download | rust-090dbb12f90a3d22183a7250ccad080a8e6d706c.tar.gz rust-090dbb12f90a3d22183a7250ccad080a8e6d706c.zip | |
Don't strip items with inherited visibility in AliasedNonLocalStripper
| -rw-r--r-- | src/librustdoc/passes/strip_aliased_non_local.rs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/librustdoc/passes/strip_aliased_non_local.rs b/src/librustdoc/passes/strip_aliased_non_local.rs index 848cbd5ed99..ac7d422ec80 100644 --- a/src/librustdoc/passes/strip_aliased_non_local.rs +++ b/src/librustdoc/passes/strip_aliased_non_local.rs @@ -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)); } } |
