@@ -252,6 +252,13 @@ fn doc_type<'tcx>(doc: rbml::Doc, tcx: &ty::ctxt<'tcx>, cdata: Cmd) -> Ty<'tcx>
252
252
|_, did| translate_def_id ( cdata, did) )
253
253
}
254
254
255
+ fn maybe_doc_type < ' tcx > ( doc : rbml:: Doc , tcx : & ty:: ctxt < ' tcx > , cdata : Cmd ) -> Option < Ty < ' tcx > > {
256
+ reader:: maybe_get_doc ( doc, tag_items_data_item_type) . map ( |tp| {
257
+ parse_ty_data ( tp. data , cdata. cnum , tp. start , tcx,
258
+ |_, did| translate_def_id ( cdata, did) )
259
+ } )
260
+ }
261
+
255
262
fn doc_method_fty < ' tcx > ( doc : rbml:: Doc , tcx : & ty:: ctxt < ' tcx > ,
256
263
cdata : Cmd ) -> ty:: BareFnTy < ' tcx > {
257
264
let tp = reader:: get_doc ( doc, tag_item_method_fty) ;
@@ -875,24 +882,24 @@ pub fn get_impl_or_trait_item<'tcx>(intr: Rc<IdentInterner>,
875
882
id : ast:: NodeId ,
876
883
tcx : & ty:: ctxt < ' tcx > )
877
884
-> ty:: ImplOrTraitItem < ' tcx > {
878
- let method_doc = lookup_item ( id, cdata. data ( ) ) ;
885
+ let item_doc = lookup_item ( id, cdata. data ( ) ) ;
879
886
880
- let def_id = item_def_id ( method_doc , cdata) ;
887
+ let def_id = item_def_id ( item_doc , cdata) ;
881
888
882
- let container_id = item_require_parent_item ( cdata, method_doc ) ;
889
+ let container_id = item_require_parent_item ( cdata, item_doc ) ;
883
890
let container_doc = lookup_item ( container_id. node , cdata. data ( ) ) ;
884
891
let container = match item_family ( container_doc) {
885
892
Trait => TraitContainer ( container_id) ,
886
893
_ => ImplContainer ( container_id) ,
887
894
} ;
888
895
889
- let name = item_name ( & * intr, method_doc ) ;
890
- let vis = item_visibility ( method_doc ) ;
896
+ let name = item_name ( & * intr, item_doc ) ;
897
+ let vis = item_visibility ( item_doc ) ;
891
898
892
- match item_sort ( method_doc ) {
899
+ match item_sort ( item_doc ) {
893
900
Some ( 'C' ) => {
894
- let ty = doc_type ( method_doc , tcx, cdata) ;
895
- let default = get_provided_source ( method_doc , cdata) ;
901
+ let ty = doc_type ( item_doc , tcx, cdata) ;
902
+ let default = get_provided_source ( item_doc , cdata) ;
896
903
ty:: ConstTraitItem ( Rc :: new ( ty:: AssociatedConst {
897
904
name : name,
898
905
ty : ty,
@@ -903,11 +910,11 @@ pub fn get_impl_or_trait_item<'tcx>(intr: Rc<IdentInterner>,
903
910
} ) )
904
911
}
905
912
Some ( 'r' ) | Some ( 'p' ) => {
906
- let generics = doc_generics ( method_doc , tcx, cdata, tag_method_ty_generics) ;
907
- let predicates = doc_predicates ( method_doc , tcx, cdata, tag_method_ty_generics) ;
908
- let fty = doc_method_fty ( method_doc , tcx, cdata) ;
909
- let explicit_self = get_explicit_self ( method_doc ) ;
910
- let provided_source = get_provided_source ( method_doc , cdata) ;
913
+ let generics = doc_generics ( item_doc , tcx, cdata, tag_method_ty_generics) ;
914
+ let predicates = doc_predicates ( item_doc , tcx, cdata, tag_method_ty_generics) ;
915
+ let fty = doc_method_fty ( item_doc , tcx, cdata) ;
916
+ let explicit_self = get_explicit_self ( item_doc ) ;
917
+ let provided_source = get_provided_source ( item_doc , cdata) ;
911
918
912
919
ty:: MethodTraitItem ( Rc :: new ( ty:: Method :: new ( name,
913
920
generics,
@@ -920,8 +927,10 @@ pub fn get_impl_or_trait_item<'tcx>(intr: Rc<IdentInterner>,
920
927
provided_source) ) )
921
928
}
922
929
Some ( 't' ) => {
930
+ let ty = maybe_doc_type ( item_doc, tcx, cdata) ;
923
931
ty:: TypeTraitItem ( Rc :: new ( ty:: AssociatedType {
924
932
name : name,
933
+ ty : ty,
925
934
vis : vis,
926
935
def_id : def_id,
927
936
container : container,
0 commit comments