summaryrefslogtreecommitdiffstats
path: root/src/librustdoc/passes/strip_hidden.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:20:39 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:20:39 +0000
commit1376c5a617be5c25655d0d7cb63e3beaa5a6e026 (patch)
tree3bb8d61aee02bc7a15eab3f36e3b921afc2075d0 /src/librustdoc/passes/strip_hidden.rs
parentReleasing progress-linux version 1.69.0+dfsg1-1~progress7.99u1. (diff)
downloadrustc-1376c5a617be5c25655d0d7cb63e3beaa5a6e026.tar.xz
rustc-1376c5a617be5c25655d0d7cb63e3beaa5a6e026.zip
Merging upstream version 1.70.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/librustdoc/passes/strip_hidden.rs')
-rw-r--r--src/librustdoc/passes/strip_hidden.rs9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/librustdoc/passes/strip_hidden.rs b/src/librustdoc/passes/strip_hidden.rs
index 890b3e8d6..a688aa148 100644
--- a/src/librustdoc/passes/strip_hidden.rs
+++ b/src/librustdoc/passes/strip_hidden.rs
@@ -121,9 +121,14 @@ impl<'a, 'tcx> DocFolder for Stripper<'a, 'tcx> {
// strip things like impl methods but when doing so
// we must not add any items to the `retained` set.
let old = mem::replace(&mut self.update_retained, false);
- let ret = strip_item(self.set_is_in_hidden_item_and_fold(true, i));
+ let ret = self.set_is_in_hidden_item_and_fold(true, i);
self.update_retained = old;
- Some(ret)
+ if ret.is_crate() {
+ // We don't strip the crate, even if it has `#[doc(hidden)]`.
+ Some(ret)
+ } else {
+ Some(strip_item(ret))
+ }
}
_ => {
let ret = self.set_is_in_hidden_item_and_fold(true, i);