From c05cfab7f979f72a25821060576a2aaea4c61ef9 Mon Sep 17 00:00:00 2001 From: Tom Jakubowski <tom@crystae.net> Date: Sat, 26 Jul 2014 16:13:01 -0700 Subject: [PATCH] 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 #15490 --- src/librustdoc/html/render.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index eed058878e082..95637d311d8c9 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -845,8 +845,12 @@ impl DocFolder for Cache { } _ => (None, Some(self.stack.as_slice())) }; + let hidden_field = match item.inner { + clean::StructFieldItem(clean::HiddenStructField) => true, + _ => false + }; match parent { - (parent, Some(path)) if !self.privmod => { + (parent, Some(path)) if !self.privmod && !hidden_field => { self.search_index.push(IndexItem { ty: shortty(&item), name: s.to_string(),