Skip to content

Commit bdec113

Browse files
committed
fix(rustdoc): print the doc(hidden) attribute the same as others
Closes #132304
1 parent 4ed8cf4 commit bdec113

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

src/librustdoc/clean/types.rs

+6
Original file line numberDiff line numberDiff line change
@@ -760,6 +760,11 @@ impl Item {
760760
}
761761
})
762762
.collect();
763+
764+
if !keep_as_is && self.is_doc_hidden() {
765+
attrs.push("#[doc(hidden)]".into());
766+
}
767+
763768
if !keep_as_is
764769
&& let Some(def_id) = self.def_id()
765770
&& let ItemType::Struct | ItemType::Enum | ItemType::Union = self.type_()
@@ -822,6 +827,7 @@ impl Item {
822827
attrs.push(format!("#[repr({})]", out.join(", ")));
823828
}
824829
}
830+
825831
attrs
826832
}
827833

src/librustdoc/html/format.rs

+1-8
Original file line numberDiff line numberDiff line change
@@ -1610,14 +1610,7 @@ pub(crate) fn visibility_print_with_space<'a, 'tcx: 'a>(
16101610
}
16111611
};
16121612

1613-
let is_doc_hidden = item.is_doc_hidden();
1614-
display_fn(move |f| {
1615-
if is_doc_hidden {
1616-
f.write_str("#[doc(hidden)] ")?;
1617-
}
1618-
1619-
f.write_str(&vis)
1620-
})
1613+
display_fn(move |f| f.write_str(&vis))
16211614
}
16221615

16231616
pub(crate) trait PrintWithSpace {

0 commit comments

Comments
 (0)