Skip to content

Commit

Permalink
collect impl items from the HIR if available
Browse files Browse the repository at this point in the history
  • Loading branch information
QuietMisdreavus committed Sep 20, 2018
1 parent 978c13a commit fe26efe
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions src/librustdoc/clean/inline.rs
Expand Up @@ -335,13 +335,24 @@ pub fn build_impl(cx: &DocContext, did: DefId, ret: &mut Vec<clean::Item>) {
}

let predicates = tcx.predicates_of(did);
let trait_items = tcx.associated_items(did).filter_map(|item| {
if associated_trait.is_some() || item.vis == ty::Visibility::Public {
Some(item.clean(cx))
} else {
None
let trait_items = if let Some(nodeid) = tcx.hir.as_local_node_id(did) {
match tcx.hir.expect_item(nodeid).node {
hir::ItemKind::Impl(.., ref item_ids) => {
item_ids.iter()
.map(|ii| tcx.hir.impl_item(ii.id).clean(cx))
.collect::<Vec<_>>()
}
_ => panic!("did given to build_impl was not an impl"),
}
}).collect::<Vec<_>>();
} else {
tcx.associated_items(did).filter_map(|item| {
if associated_trait.is_some() || item.vis == ty::Visibility::Public {
Some(item.clean(cx))
} else {
None
}
}).collect::<Vec<_>>()
};
let polarity = tcx.impl_polarity(did);
let trait_ = associated_trait.clean(cx).map(|bound| {
match bound {
Expand Down

0 comments on commit fe26efe

Please sign in to comment.