]> git.lizzy.rs Git - rust.git/commitdiff
rustdoc: Keep hidden struct fields out of search
authorTom Jakubowski <tom@crystae.net>
Sat, 26 Jul 2014 23:13:01 +0000 (16:13 -0700)
committerTom Jakubowski <tom@crystae.net>
Sat, 26 Jul 2014 23:13:01 +0000 (16:13 -0700)
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

index eed058878e0820f9c41f1ffb51803e58710588fd..95637d311d8c9f302c607672ca63049e8f102400 100644 (file)
@@ -845,8 +845,12 @@ fn fold_item(&mut self, item: clean::Item) -> Option<clean::Item> {
                     }
                     _ => (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(),