Skip to content

Commit c05cfab

Browse files
committed
rustdoc: Keep hidden struct fields out of search
Previously, private and `#[doc(hidden)]` struct fields appeared in the search index despite being hidden from the struct's documentation. Fix rust-lang#15490
1 parent d4dfb7d commit c05cfab

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/librustdoc/html/render.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -845,8 +845,12 @@ impl DocFolder for Cache {
845845
}
846846
_ => (None, Some(self.stack.as_slice()))
847847
};
848+
let hidden_field = match item.inner {
849+
clean::StructFieldItem(clean::HiddenStructField) => true,
850+
_ => false
851+
};
848852
match parent {
849-
(parent, Some(path)) if !self.privmod => {
853+
(parent, Some(path)) if !self.privmod && !hidden_field => {
850854
self.search_index.push(IndexItem {
851855
ty: shortty(&item),
852856
name: s.to_string(),

0 commit comments

Comments
 (0)