collect impl items from the HIR if available
This commit is contained in:
parent
978c13aa02
commit
fe26efe748
@ -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 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user