@@ -147,14 +147,22 @@ pub fn record_extern_fqn(cx: &DocContext, did: ast::DefId, kind: clean::TypeKind
147
147
148
148
pub fn build_external_trait ( cx : & DocContext , tcx : & ty:: ctxt ,
149
149
did : ast:: DefId ) -> clean:: Trait {
150
+ use clean:: TraitMethod ;
151
+
150
152
let def = ty:: lookup_trait_def ( tcx, did) ;
151
153
let trait_items = ty:: trait_items ( tcx, did) . clean ( cx) ;
152
154
let provided = ty:: provided_trait_methods ( tcx, did) ;
153
155
let items = trait_items. into_iter ( ) . map ( |trait_item| {
154
- if provided. iter ( ) . any ( |a| a. def_id == trait_item. def_id ) {
155
- clean:: ProvidedMethod ( trait_item)
156
- } else {
157
- clean:: RequiredMethod ( trait_item)
156
+ match trait_item. inner {
157
+ clean:: TyMethodItem ( _) => {
158
+ if provided. iter ( ) . any ( |a| a. def_id == trait_item. def_id ) {
159
+ TraitMethod :: ProvidedMethod ( trait_item)
160
+ } else {
161
+ TraitMethod :: RequiredMethod ( trait_item)
162
+ }
163
+ } ,
164
+ clean:: AssociatedTypeItem ( _) => TraitMethod :: TypeTraitItem ( trait_item) ,
165
+ _ => unreachable ! ( )
158
166
}
159
167
} ) ;
160
168
let trait_def = ty:: lookup_trait_def ( tcx, did) ;
@@ -311,9 +319,21 @@ fn build_impl(cx: &DocContext, tcx: &ty::ctxt,
311
319
} ;
312
320
Some ( item)
313
321
}
314
- ty:: TypeTraitItem ( _) => {
315
- // FIXME(pcwalton): Implement.
316
- None
322
+ ty:: TypeTraitItem ( ref assoc_ty) => {
323
+ let did = assoc_ty. def_id ;
324
+ let type_scheme = ty:: lookup_item_type ( tcx, did) ;
325
+ // Not sure the choice of ParamSpace actually matters here, because an
326
+ // associated type won't have generics on the LHS
327
+ let typedef = ( type_scheme, subst:: ParamSpace :: TypeSpace ) . clean ( cx) ;
328
+ Some ( clean:: Item {
329
+ name : Some ( assoc_ty. name . clean ( cx) ) ,
330
+ inner : clean:: TypedefItem ( typedef) ,
331
+ source : clean:: Span :: empty ( ) ,
332
+ attrs : vec ! [ ] ,
333
+ visibility : None ,
334
+ stability : stability:: lookup ( tcx, did) . clean ( cx) ,
335
+ def_id : did
336
+ } )
317
337
}
318
338
}
319
339
} ) . collect ( ) ;
0 commit comments