Skip to content

Commit

Permalink
Rollup merge of rust-lang#109726 - GuillaumeGomez:doc-hidden-crate, r…
Browse files Browse the repository at this point in the history
…=notriddle

rustdoc: Don't strip crate module

Until we decide something for rust-lang#109695, rustdoc won't crash anymore because the crate folder doesn't exist.

r? `@notriddle`
  • Loading branch information
matthiaskrgr authored Mar 29, 2023
2 parents 85c3845 + cdc4fa4 commit 02cb4da
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/librustdoc/passes/strip_hidden.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
8 changes: 8 additions & 0 deletions tests/rustdoc/issue-109695-crate-doc-hidden.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// This test ensures that even if the crate module is `#[doc(hidden)]`, the file
// is generated.

// @has 'foo/index.html'
// @has 'foo/all.html'

#![crate_name = "foo"]
#![doc(hidden)]

0 comments on commit 02cb4da

Please sign in to comment.