@@ -252,6 +252,13 @@ fn doc_type<'tcx>(doc: rbml::Doc, tcx: &ty::ctxt<'tcx>, cdata: Cmd) -> Ty<'tcx>
252252 |_, did| translate_def_id ( cdata, did) )
253253}
254254
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+
255262fn doc_method_fty < ' tcx > ( doc : rbml:: Doc , tcx : & ty:: ctxt < ' tcx > ,
256263 cdata : Cmd ) -> ty:: BareFnTy < ' tcx > {
257264 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>,
875882 id : ast:: NodeId ,
876883 tcx : & ty:: ctxt < ' tcx > )
877884 -> ty:: ImplOrTraitItem < ' tcx > {
878- let method_doc = lookup_item ( id, cdata. data ( ) ) ;
885+ let item_doc = lookup_item ( id, cdata. data ( ) ) ;
879886
880- let def_id = item_def_id ( method_doc , cdata) ;
887+ let def_id = item_def_id ( item_doc , cdata) ;
881888
882- let container_id = item_require_parent_item ( cdata, method_doc ) ;
889+ let container_id = item_require_parent_item ( cdata, item_doc ) ;
883890 let container_doc = lookup_item ( container_id. node , cdata. data ( ) ) ;
884891 let container = match item_family ( container_doc) {
885892 Trait => TraitContainer ( container_id) ,
886893 _ => ImplContainer ( container_id) ,
887894 } ;
888895
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 ) ;
891898
892- match item_sort ( method_doc ) {
899+ match item_sort ( item_doc ) {
893900 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) ;
896903 ty:: ConstTraitItem ( Rc :: new ( ty:: AssociatedConst {
897904 name : name,
898905 ty : ty,
@@ -903,11 +910,11 @@ pub fn get_impl_or_trait_item<'tcx>(intr: Rc<IdentInterner>,
903910 } ) )
904911 }
905912 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) ;
911918
912919 ty:: MethodTraitItem ( Rc :: new ( ty:: Method :: new ( name,
913920 generics,
@@ -920,8 +927,10 @@ pub fn get_impl_or_trait_item<'tcx>(intr: Rc<IdentInterner>,
920927 provided_source) ) )
921928 }
922929 Some ( 't' ) => {
930+ let ty = maybe_doc_type ( item_doc, tcx, cdata) ;
923931 ty:: TypeTraitItem ( Rc :: new ( ty:: AssociatedType {
924932 name : name,
933+ ty : ty,
925934 vis : vis,
926935 def_id : def_id,
927936 container : container,
0 commit comments