Skip to content

Commit 02cb4da

Browse files
authored
Rollup merge of #109726 - GuillaumeGomez:doc-hidden-crate, r=notriddle
rustdoc: Don't strip crate module Until we decide something for #109695, rustdoc won't crash anymore because the crate folder doesn't exist. r? `@notriddle`
2 parents 85c3845 + cdc4fa4 commit 02cb4da

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

src/librustdoc/passes/strip_hidden.rs

+7-2
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,14 @@ impl<'a, 'tcx> DocFolder for Stripper<'a, 'tcx> {
121121
// strip things like impl methods but when doing so
122122
// we must not add any items to the `retained` set.
123123
let old = mem::replace(&mut self.update_retained, false);
124-
let ret = strip_item(self.set_is_in_hidden_item_and_fold(true, i));
124+
let ret = self.set_is_in_hidden_item_and_fold(true, i);
125125
self.update_retained = old;
126-
Some(ret)
126+
if ret.is_crate() {
127+
// We don't strip the crate, even if it has `#[doc(hidden)]`.
128+
Some(ret)
129+
} else {
130+
Some(strip_item(ret))
131+
}
127132
}
128133
_ => {
129134
let ret = self.set_is_in_hidden_item_and_fold(true, i);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// This test ensures that even if the crate module is `#[doc(hidden)]`, the file
2+
// is generated.
3+
4+
// @has 'foo/index.html'
5+
// @has 'foo/all.html'
6+
7+
#![crate_name = "foo"]
8+
#![doc(hidden)]

0 commit comments

Comments
 (0)