Rollup merge of #109726 - GuillaumeGomez:doc-hidden-crate, r=notriddle
rustdoc: Don't strip crate module Until we decide something for https://github.com/rust-lang/rust/issues/109695, rustdoc won't crash anymore because the crate folder doesn't exist. r? `@notriddle`
This commit is contained in:
commit
02cb4da896
@ -121,9 +121,14 @@ fn fold_item(&mut self, i: Item) -> Option<Item> {
|
|||||||
// strip things like impl methods but when doing so
|
// strip things like impl methods but when doing so
|
||||||
// we must not add any items to the `retained` set.
|
// we must not add any items to the `retained` set.
|
||||||
let old = mem::replace(&mut self.update_retained, false);
|
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;
|
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);
|
let ret = self.set_is_in_hidden_item_and_fold(true, i);
|
||||||
|
8
tests/rustdoc/issue-109695-crate-doc-hidden.rs
Normal file
8
tests/rustdoc/issue-109695-crate-doc-hidden.rs
Normal file
@ -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)]
|
Loading…
Reference in New Issue
Block a user