Skip to content

Commit 52a3d38

Browse files
committed
rustdoc: Strip impls of stripped private types
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.
1 parent 92c5738 commit 52a3d38

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/librustdoc/passes.rs

+10-2
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,16 @@ impl<'a> fold::DocFolder for Stripper<'a> {
110110
// handled below
111111
clean::ModuleItem(..) => {}
112112

113-
// impls/tymethods have no control over privacy
114-
clean::ImplItem(..) | clean::TyMethodItem(..) => {}
113+
// trait impls for private items should be stripped
114+
clean::ImplItem(clean::Impl{ for_: clean::ResolvedPath{ id: ref for_id, .. }, .. }) => {
115+
if !self.exported_items.contains(for_id) {
116+
return None;
117+
}
118+
}
119+
clean::ImplItem(..) => {}
120+
121+
// tymethods have no control over privacy
122+
clean::TyMethodItem(..) => {}
115123
}
116124

117125
let fastreturn = match i.inner {

0 commit comments

Comments
 (0)