Skip to content

Commit 9f0c29a

Browse files
committed
auto merge of #17846 : tomjakubowski/rust/rustdoc-hide-private-traits, r=alexcrichton
Fix #16563
2 parents 1d64756 + 370c9c5 commit 9f0c29a

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/librustdoc/passes.rs

+12-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,18 @@ impl<'a> fold::DocFolder for Stripper<'a> {
134134
clean::StructItem(..) | clean::EnumItem(..) |
135135
clean::TraitItem(..) | clean::FunctionItem(..) |
136136
clean::VariantItem(..) | clean::MethodItem(..) |
137-
clean::ForeignFunctionItem(..) | clean::ForeignStaticItem(..) |
137+
clean::ForeignFunctionItem(..) | clean::ForeignStaticItem(..) => {
138+
if ast_util::is_local(i.def_id) {
139+
if !self.exported_items.contains(&i.def_id.node) {
140+
return None;
141+
}
142+
// Traits are in exported_items even when they're totally private.
143+
if i.is_trait() && i.visibility != Some(ast::Public) {
144+
return None;
145+
}
146+
}
147+
}
148+
138149
clean::ConstantItem(..) => {
139150
if ast_util::is_local(i.def_id) &&
140151
!self.exported_items.contains(&i.def_id.node) {

0 commit comments

Comments
 (0)