@@ -357,6 +357,7 @@ impl<'l, 'tcx: 'l, 'll, D: Dump + 'll> DumpVisitor<'l, 'tcx, 'll, D> {
357357 parent : None ,
358358 visibility : Visibility :: Inherited ,
359359 docs : String :: new ( ) ,
360+ sig : None ,
360361 } . lower ( self . tcx ) ) ;
361362 }
362363 }
@@ -429,6 +430,7 @@ impl<'l, 'tcx: 'l, 'll, D: Dump + 'll> DumpVisitor<'l, 'tcx, 'll, D> {
429430 parent : trait_id,
430431 visibility : vis,
431432 docs : docs_for_attrs ( attrs) ,
433+ sig : method_data. sig ,
432434 } . lower ( self . tcx ) ) ;
433435 }
434436
@@ -500,6 +502,7 @@ impl<'l, 'tcx: 'l, 'll, D: Dump + 'll> DumpVisitor<'l, 'tcx, 'll, D> {
500502 visibility : Visibility :: Inherited ,
501503 parent : None ,
502504 docs : String :: new ( ) ,
505+ sig : None ,
503506 } . lower ( self . tcx ) ) ;
504507 }
505508 }
@@ -572,6 +575,7 @@ impl<'l, 'tcx: 'l, 'll, D: Dump + 'll> DumpVisitor<'l, 'tcx, 'll, D> {
572575 parent : Some ( parent_id) ,
573576 visibility : vis,
574577 docs : docs_for_attrs ( attrs) ,
578+ sig : None ,
575579 } . lower ( self . tcx ) ) ;
576580 }
577581
@@ -615,11 +619,10 @@ impl<'l, 'tcx: 'l, 'll, D: Dump + 'll> DumpVisitor<'l, 'tcx, 'll, D> {
615619 fields : fields,
616620 visibility : From :: from ( & item. vis ) ,
617621 docs : docs_for_attrs ( & item. attrs ) ,
622+ sig : self . save_ctxt . sig_base ( item) ,
618623 } . lower ( self . tcx ) ) ;
619624 }
620625
621-
622- // fields
623626 for field in def. fields ( ) {
624627 self . process_struct_field_def ( field, item. id ) ;
625628 self . visit_ty ( & field. ty ) ;
@@ -648,6 +651,18 @@ impl<'l, 'tcx: 'l, 'll, D: Dump + 'll> DumpVisitor<'l, 'tcx, 'll, D> {
648651 qualname. push_str ( "::" ) ;
649652 qualname. push_str ( & name) ;
650653
654+ let text = self . span . signature_string_for_span ( variant. span ) ;
655+ let ident_start = text. find ( & name) . unwrap ( ) ;
656+ let ident_end = ident_start + name. len ( ) ;
657+ let sig = Signature {
658+ span : variant. span ,
659+ text : text,
660+ ident_start : ident_start,
661+ ident_end : ident_end,
662+ defs : vec ! [ ] ,
663+ refs : vec ! [ ] ,
664+ } ;
665+
651666 match variant. node . data {
652667 ast:: VariantData :: Struct ( ref fields, _) => {
653668 let sub_span = self . span . span_for_first_ident ( variant. span ) ;
@@ -669,6 +684,7 @@ impl<'l, 'tcx: 'l, 'll, D: Dump + 'll> DumpVisitor<'l, 'tcx, 'll, D> {
669684 scope : enum_data. scope ,
670685 parent : Some ( make_def_id ( item. id , & self . tcx . map ) ) ,
671686 docs : docs_for_attrs ( & variant. node . attrs ) ,
687+ sig : sig,
672688 } . lower ( self . tcx ) ) ;
673689 }
674690 }
@@ -694,6 +710,7 @@ impl<'l, 'tcx: 'l, 'll, D: Dump + 'll> DumpVisitor<'l, 'tcx, 'll, D> {
694710 scope : enum_data. scope ,
695711 parent : Some ( make_def_id ( item. id , & self . tcx . map ) ) ,
696712 docs : docs_for_attrs ( & variant. node . attrs ) ,
713+ sig : sig,
697714 } . lower ( self . tcx ) ) ;
698715 }
699716 }
@@ -778,6 +795,7 @@ impl<'l, 'tcx: 'l, 'll, D: Dump + 'll> DumpVisitor<'l, 'tcx, 'll, D> {
778795 items : methods. iter ( ) . map ( |i| i. id ) . collect ( ) ,
779796 visibility : From :: from ( & item. vis ) ,
780797 docs : docs_for_attrs ( & item. attrs ) ,
798+ sig : self . save_ctxt . sig_base ( item) ,
781799 } . lower ( self . tcx ) ) ;
782800 }
783801
@@ -1043,6 +1061,7 @@ impl<'l, 'tcx: 'l, 'll, D: Dump + 'll> DumpVisitor<'l, 'tcx, 'll, D> {
10431061 parent : None ,
10441062 visibility : Visibility :: Inherited ,
10451063 docs : String :: new ( ) ,
1064+ sig : None ,
10461065 } . lower ( self . tcx ) ) ;
10471066 }
10481067 }
@@ -1257,10 +1276,10 @@ impl<'l, 'tcx: 'l, 'll, D: Dump +'ll> Visitor<'l> for DumpVisitor<'l, 'tcx, 'll,
12571276 Struct ( ref def, ref ty_params) => self . process_struct ( item, def, ty_params) ,
12581277 Enum ( ref def, ref ty_params) => self . process_enum ( item, def, ty_params) ,
12591278 Impl ( ..,
1260- ref ty_params,
1261- ref trait_ref,
1262- ref typ,
1263- ref impl_items) => {
1279+ ref ty_params,
1280+ ref trait_ref,
1281+ ref typ,
1282+ ref impl_items) => {
12641283 self . process_impl ( item, ty_params, trait_ref, & typ, impl_items)
12651284 }
12661285 Trait ( _, ref generics, ref trait_refs, ref methods) =>
@@ -1283,6 +1302,7 @@ impl<'l, 'tcx: 'l, 'll, D: Dump +'ll> Visitor<'l> for DumpVisitor<'l, 'tcx, 'll,
12831302 visibility : From :: from ( & item. vis ) ,
12841303 parent : None ,
12851304 docs : docs_for_attrs ( & item. attrs ) ,
1305+ sig : Some ( self . save_ctxt . sig_base ( item) ) ,
12861306 } . lower ( self . tcx ) ) ;
12871307 }
12881308
@@ -1492,6 +1512,7 @@ impl<'l, 'tcx: 'l, 'll, D: Dump +'ll> Visitor<'l> for DumpVisitor<'l, 'tcx, 'll,
14921512 parent : None ,
14931513 visibility : Visibility :: Inherited ,
14941514 docs : String :: new ( ) ,
1515+ sig : None ,
14951516 } . lower ( self . tcx ) ) ;
14961517 }
14971518 }
0 commit comments