rustdoc: Separate associated types from methods

Fix #21142
This commit is contained in:
Tom Jakubowski 2015-01-14 07:28:37 -08:00
parent d47a11353d
commit aaf595eab9

View File

@ -147,14 +147,22 @@ pub fn record_extern_fqn(cx: &DocContext, did: ast::DefId, kind: clean::TypeKind
pub fn build_external_trait(cx: &DocContext, tcx: &ty::ctxt,
did: ast::DefId) -> clean::Trait {
use clean::TraitMethod;
let def = ty::lookup_trait_def(tcx, did);
let trait_items = ty::trait_items(tcx, did).clean(cx);
let provided = ty::provided_trait_methods(tcx, did);
let items = trait_items.into_iter().map(|trait_item| {
if provided.iter().any(|a| a.def_id == trait_item.def_id) {
clean::ProvidedMethod(trait_item)
} else {
clean::RequiredMethod(trait_item)
match trait_item.inner {
clean::TyMethodItem(_) => {
if provided.iter().any(|a| a.def_id == trait_item.def_id) {
TraitMethod::ProvidedMethod(trait_item)
} else {
TraitMethod::RequiredMethod(trait_item)
}
},
clean::AssociatedTypeItem(_) => TraitMethod::TypeTraitItem(trait_item),
_ => unreachable!()
}
});
let trait_def = ty::lookup_trait_def(tcx, did);