Skip to content

Commit 8323b05

Browse files
Greatly extend explanations on strip_hidden items
Co-authored-by: Michael Howell <[email protected]>
1 parent d803cae commit 8323b05

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/librustdoc/passes/strip_hidden.rs

+8-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,14 @@ impl<'a> DocFolder for Stripper<'a> {
3838
fn fold_item(&mut self, i: Item) -> Option<Item> {
3939
if i.attrs.lists(sym::doc).has_word(sym::hidden) {
4040
debug!("strip_hidden: stripping {:?} {:?}", i.type_(), i.name);
41-
// use a dedicated hidden item for given item type if any
41+
// Use a dedicated hidden item for fields, variants, and modules.
42+
// We need to keep private fields and variants, so that the docs
43+
// can show a placeholder "// some variants omitted". We need to keep
44+
// private modules, because they can contain impl blocks, and impl
45+
// block privacy is inherited from the type and trait, not from the
46+
// module it's defined in. Both of these are marked "stripped," and
47+
// not included in the final docs, but since they still have an effect
48+
// on the final doc, cannot be completely removed from the Clean IR.
4249
match *i.kind {
4350
clean::StructFieldItem(..) | clean::ModuleItem(..) | clean::VariantItem(..) => {
4451
// We need to recurse into stripped modules to

0 commit comments

Comments
 (0)