]> git.lizzy.rs Git - rust.git/commitdiff
rustdoc: Strip impls of stripped private types
authorKevin Ballard <kevin@sb.org>
Tue, 11 Feb 2014 22:29:23 +0000 (14:29 -0800)
committerKevin Ballard <kevin@sb.org>
Fri, 14 Feb 2014 18:50:19 +0000 (10:50 -0800)
In strip-private, also strip impls of traits for private types. This
fixes the search index so searching for "drop", "eq", etc doesn't throw
an exception.

src/librustdoc/passes.rs

index 30643737078e827b23d727d0814eb42627634501..fce4cab52c937027b7d596b5bd24a235910d1e0f 100644 (file)
@@ -110,8 +110,16 @@ fn fold_item(&mut self, i: Item) -> Option<Item> {
             // handled below
             clean::ModuleItem(..) => {}
 
-            // impls/tymethods have no control over privacy
-            clean::ImplItem(..) | clean::TyMethodItem(..) => {}
+            // trait impls for private items should be stripped
+            clean::ImplItem(clean::Impl{ for_: clean::ResolvedPath{ id: ref for_id, .. }, .. }) => {
+                if !self.exported_items.contains(for_id) {
+                    return None;
+                }
+            }
+            clean::ImplItem(..) => {}
+
+            // tymethods have no control over privacy
+            clean::TyMethodItem(..) => {}
         }
 
         let fastreturn = match i.inner {