@@ -268,30 +268,6 @@ fn item_trait_ref<'tcx>(doc: rbml::Doc, tcx: &ty::ctxt<'tcx>, cdata: Cmd)
268
268
doc_trait_ref ( tp, tcx, cdata)
269
269
}
270
270
271
- struct EnumVariantIds < ' a > {
272
- iter : reader:: TaggedDocsIterator < ' a > ,
273
- cdata : Cmd < ' a > ,
274
- }
275
-
276
- impl < ' a > Iterator for EnumVariantIds < ' a > {
277
- type Item = ast:: DefId ;
278
-
279
- fn next ( & mut self ) -> Option < ast:: DefId > {
280
- self . iter . next ( ) . map ( |p| translated_def_id ( self . cdata , p) )
281
- }
282
-
283
- fn size_hint ( & self ) -> ( usize , Option < usize > ) {
284
- self . iter . size_hint ( )
285
- }
286
- }
287
-
288
- fn enum_variant_ids < ' a > ( item : rbml:: Doc < ' a > , cdata : Cmd < ' a > ) -> EnumVariantIds < ' a > {
289
- EnumVariantIds {
290
- iter : reader:: tagged_docs ( item, tag_items_data_item_variant) ,
291
- cdata : cdata,
292
- }
293
- }
294
-
295
271
fn item_path ( item_doc : rbml:: Doc ) -> Vec < ast_map:: PathElem > {
296
272
let path_doc = reader:: get_doc ( item_doc, tag_path) ;
297
273
reader:: docs ( path_doc) . filter_map ( |( tag, elt_doc) | {
@@ -730,31 +706,14 @@ pub fn maybe_get_item_ast<'tcx>(cdata: Cmd, tcx: &ty::ctxt<'tcx>, id: ast::NodeI
730
706
}
731
707
}
732
708
733
- pub fn get_enum_variant_defs ( intr : & IdentInterner ,
734
- cdata : Cmd ,
735
- id : ast:: NodeId )
736
- -> Vec < ( def:: Def , ast:: Name , ast:: Visibility ) > {
737
- let data = cdata. data ( ) ;
738
- let items = reader:: get_doc ( rbml:: Doc :: new ( data) , tag_items) ;
739
- let item = find_item ( id, items) ;
740
- enum_variant_ids ( item, cdata) . map ( |did| {
741
- let item = find_item ( did. node , items) ;
742
- let name = item_name ( intr, item) ;
743
- let visibility = item_visibility ( item) ;
744
- match item_to_def_like ( cdata, item, did) {
745
- DlDef ( def @ def:: DefVariant ( ..) ) => ( def, name, visibility) ,
746
- _ => unreachable ! ( )
747
- }
748
- } ) . collect ( )
749
- }
750
-
751
709
pub fn get_enum_variants < ' tcx > ( intr : Rc < IdentInterner > , cdata : Cmd , id : ast:: NodeId ,
752
710
tcx : & ty:: ctxt < ' tcx > ) -> Vec < Rc < ty:: VariantInfo < ' tcx > > > {
753
711
let data = cdata. data ( ) ;
754
712
let items = reader:: get_doc ( rbml:: Doc :: new ( data) , tag_items) ;
755
713
let item = find_item ( id, items) ;
756
714
let mut disr_val = 0 ;
757
- enum_variant_ids ( item, cdata) . map ( |did| {
715
+ reader:: tagged_docs ( item, tag_items_data_item_variant) . map ( |p| {
716
+ let did = translated_def_id ( cdata, p) ;
758
717
let item = find_item ( did. node , items) ;
759
718
let ctor_ty = item_type ( ast:: DefId { krate : cdata. cnum , node : id} ,
760
719
item, tcx, cdata) ;
0 commit comments