Skip to content

Commit f5e09f3

Browse files
alexcrichtonmcpherrinm
authored andcommitted
rustdoc: Filter private methods from inlined impls
Closes rust-lang#14583
1 parent dadd959 commit f5e09f3

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/librustdoc/clean/inline.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,12 @@ fn build_impl(tcx: &ty::ctxt, did: ast::DefId) -> clean::Item {
250250
let associated_trait = csearch::get_impl_trait(tcx, did);
251251
let attrs = load_attrs(tcx, did);
252252
let ty = ty::lookup_item_type(tcx, did);
253-
let methods = csearch::get_impl_methods(&tcx.sess.cstore, did).iter().map(|did| {
253+
let methods = csearch::get_impl_methods(&tcx.sess.cstore,
254+
did).iter().filter_map(|did| {
255+
let method = ty::method(tcx, *did);
256+
if method.vis != ast::Public && associated_trait.is_none() {
257+
return None
258+
}
254259
let mut item = match ty::method(tcx, *did).clean() {
255260
clean::Provided(item) => item,
256261
clean::Required(item) => item,
@@ -268,7 +273,7 @@ fn build_impl(tcx: &ty::ctxt, did: ast::DefId) -> clean::Item {
268273
}
269274
_ => fail!("not a tymethod"),
270275
};
271-
item
276+
Some(item)
272277
}).collect();
273278
clean::Item {
274279
inner: clean::ImplItem(clean::Impl {

0 commit comments

Comments
 (0)