@@ -169,7 +169,7 @@ impl <'l, 'tcx> DumpCsvVisitor<'l, 'tcx> {
169
169
} ;
170
170
self . fmt . sub_mod_ref_str ( path. span ,
171
171
* span,
172
- & qualname[ .. ] ,
172
+ & qualname,
173
173
self . cur_scope ) ;
174
174
}
175
175
}
@@ -192,7 +192,7 @@ impl <'l, 'tcx> DumpCsvVisitor<'l, 'tcx> {
192
192
} ;
193
193
self . fmt . sub_mod_ref_str ( path. span ,
194
194
* span,
195
- & qualname[ .. ] ,
195
+ & qualname,
196
196
self . cur_scope ) ;
197
197
}
198
198
}
@@ -211,7 +211,7 @@ impl <'l, 'tcx> DumpCsvVisitor<'l, 'tcx> {
211
211
let ( ref span, ref qualname) = sub_paths[ len-2 ] ;
212
212
self . fmt . sub_type_ref_str ( path. span ,
213
213
* span,
214
- & qualname[ .. ] ) ;
214
+ & qualname) ;
215
215
216
216
// write the other sub-paths
217
217
if len <= 2 {
@@ -221,7 +221,7 @@ impl <'l, 'tcx> DumpCsvVisitor<'l, 'tcx> {
221
221
for & ( ref span, ref qualname) in sub_paths {
222
222
self . fmt . sub_mod_ref_str ( path. span ,
223
223
* span,
224
- & qualname[ .. ] ,
224
+ & qualname,
225
225
self . cur_scope ) ;
226
226
}
227
227
}
@@ -293,7 +293,7 @@ impl <'l, 'tcx> DumpCsvVisitor<'l, 'tcx> {
293
293
id,
294
294
qualname,
295
295
& path_to_string ( p) ,
296
- & typ[ .. ] ) ;
296
+ & typ) ;
297
297
}
298
298
}
299
299
}
@@ -451,9 +451,9 @@ impl <'l, 'tcx> DumpCsvVisitor<'l, 'tcx> {
451
451
Some ( sub_span) => self . fmt . field_str ( field. span ,
452
452
Some ( sub_span) ,
453
453
field. node . id ,
454
- & name[ .. ] ,
455
- & qualname[ .. ] ,
456
- & typ[ .. ] ,
454
+ & name,
455
+ & qualname,
456
+ & typ,
457
457
scope_id) ,
458
458
None => self . sess . span_bug ( field. span ,
459
459
& format ! ( "Could not find sub-span for field {}" ,
@@ -485,7 +485,7 @@ impl <'l, 'tcx> DumpCsvVisitor<'l, 'tcx> {
485
485
self . fmt . typedef_str ( full_span,
486
486
Some ( * param_ss) ,
487
487
param. id ,
488
- & name[ .. ] ,
488
+ & name,
489
489
"" ) ;
490
490
}
491
491
self . visit_generics ( generics) ;
@@ -561,7 +561,7 @@ impl <'l, 'tcx> DumpCsvVisitor<'l, 'tcx> {
561
561
sub_span,
562
562
id,
563
563
& get_ident ( ( * ident) . clone ( ) ) ,
564
- & qualname[ .. ] ,
564
+ & qualname,
565
565
& self . span . snippet ( expr. span ) ,
566
566
& ty_to_string ( & * typ) ,
567
567
self . cur_scope ) ;
@@ -587,82 +587,77 @@ impl <'l, 'tcx> DumpCsvVisitor<'l, 'tcx> {
587
587
sub_span,
588
588
item. id ,
589
589
ctor_id,
590
- & qualname[ .. ] ,
590
+ & qualname,
591
591
self . cur_scope ,
592
- & val[ .. ] ) ;
592
+ & val) ;
593
593
594
594
// fields
595
595
for field in & def. fields {
596
- self . process_struct_field_def ( field, & qualname[ .. ] , item. id ) ;
596
+ self . process_struct_field_def ( field, & qualname, item. id ) ;
597
597
self . visit_ty ( & * field. node . ty ) ;
598
598
}
599
599
600
- self . process_generic_params ( ty_params, item. span , & qualname[ .. ] , item. id ) ;
600
+ self . process_generic_params ( ty_params, item. span , & qualname, item. id ) ;
601
601
}
602
602
603
603
fn process_enum ( & mut self ,
604
604
item : & ast:: Item ,
605
605
enum_definition : & ast:: EnumDef ,
606
606
ty_params : & ast:: Generics ) {
607
- let enum_name = format ! ( "::{}" , self . analysis. ty_cx. map. path_to_string( item. id) ) ;
608
- let val = self . span . snippet ( item. span ) ;
609
- match self . span . sub_span_after_keyword ( item. span , keywords:: Enum ) {
610
- Some ( sub_span) => self . fmt . enum_str ( item. span ,
611
- Some ( sub_span) ,
612
- item. id ,
613
- & enum_name[ ..] ,
614
- self . cur_scope ,
615
- & val[ ..] ) ,
616
- None => self . sess . span_bug ( item. span ,
617
- & format ! ( "Could not find subspan for enum {}" ,
618
- enum_name) ) ,
619
- }
620
- for variant in & enum_definition. variants {
621
- let name = get_ident ( variant. node . name ) ;
622
- let name = & name;
623
- let mut qualname = enum_name. clone ( ) ;
624
- qualname. push_str ( "::" ) ;
625
- qualname. push_str ( name) ;
626
- let val = self . span . snippet ( variant. span ) ;
627
- match variant. node . kind {
628
- ast:: TupleVariantKind ( ref args) => {
629
- // first ident in span is the variant's name
630
- self . fmt . tuple_variant_str ( variant. span ,
631
- self . span . span_for_first_ident ( variant. span ) ,
632
- variant. node . id ,
633
- name,
634
- & qualname[ ..] ,
635
- & enum_name[ ..] ,
636
- & val[ ..] ,
637
- item. id ) ;
638
- for arg in args {
639
- self . visit_ty ( & * arg. ty ) ;
607
+ let enum_data = self . save_ctxt . get_item_data ( item) ;
608
+ if let super :: Data :: EnumData ( enum_data) = enum_data {
609
+ self . fmt . enum_str ( item. span ,
610
+ Some ( enum_data. span ) ,
611
+ enum_data. id ,
612
+ & enum_data. qualname ,
613
+ self . cur_scope ,
614
+ & enum_data. value ) ;
615
+ for variant in & enum_definition. variants {
616
+ let name = & get_ident ( variant. node . name ) ;
617
+ let mut qualname = enum_data. qualname . clone ( ) ;
618
+ qualname. push_str ( "::" ) ;
619
+ qualname. push_str ( name) ;
620
+ let val = self . span . snippet ( variant. span ) ;
621
+ match variant. node . kind {
622
+ ast:: TupleVariantKind ( ref args) => {
623
+ // first ident in span is the variant's name
624
+ self . fmt . tuple_variant_str ( variant. span ,
625
+ self . span . span_for_first_ident ( variant. span ) ,
626
+ variant. node . id ,
627
+ name,
628
+ & qualname,
629
+ & enum_data. qualname ,
630
+ & val,
631
+ item. id ) ;
632
+ for arg in args {
633
+ self . visit_ty ( & * arg. ty ) ;
634
+ }
640
635
}
641
- }
642
- ast:: StructVariantKind ( ref struct_def) => {
643
- let ctor_id = match struct_def. ctor_id {
644
- Some ( node_id) => node_id,
645
- None => -1 ,
646
- } ;
647
- self . fmt . struct_variant_str (
648
- variant. span ,
649
- self . span . span_for_first_ident ( variant. span ) ,
650
- variant. node . id ,
651
- ctor_id,
652
- & qualname[ ..] ,
653
- & enum_name[ ..] ,
654
- & val[ ..] ,
655
- item. id ) ;
656
-
657
- for field in & struct_def. fields {
658
- self . process_struct_field_def ( field, & qualname, variant. node . id ) ;
659
- self . visit_ty ( & * field. node . ty ) ;
636
+ ast:: StructVariantKind ( ref struct_def) => {
637
+ let ctor_id = match struct_def. ctor_id {
638
+ Some ( node_id) => node_id,
639
+ None => -1 ,
640
+ } ;
641
+ self . fmt . struct_variant_str ( variant. span ,
642
+ self . span . span_for_first_ident ( variant. span ) ,
643
+ variant. node . id ,
644
+ ctor_id,
645
+ & qualname,
646
+ & enum_data. qualname ,
647
+ & val,
648
+ item. id ) ;
649
+
650
+ for field in & struct_def. fields {
651
+ self . process_struct_field_def ( field, & qualname, variant. node . id ) ;
652
+ self . visit_ty ( & * field. node . ty ) ;
653
+ }
660
654
}
661
655
}
662
656
}
657
+ self . process_generic_params ( ty_params, item. span , & enum_data. qualname , item. id ) ;
658
+ } else {
659
+ self . sess . span_bug ( item. span , "expected EnumData" ) ;
663
660
}
664
-
665
- self . process_generic_params ( ty_params, item. span , & enum_name[ ..] , item. id ) ;
666
661
}
667
662
668
663
fn process_impl ( & mut self ,
@@ -727,9 +722,9 @@ impl <'l, 'tcx> DumpCsvVisitor<'l, 'tcx> {
727
722
self . fmt . trait_str ( item. span ,
728
723
sub_span,
729
724
item. id ,
730
- & qualname[ .. ] ,
725
+ & qualname,
731
726
self . cur_scope ,
732
- & val[ .. ] ) ;
727
+ & val) ;
733
728
734
729
// super-traits
735
730
for super_bound in & * * trait_refs {
@@ -761,7 +756,7 @@ impl <'l, 'tcx> DumpCsvVisitor<'l, 'tcx> {
761
756
}
762
757
763
758
// walk generics and methods
764
- self . process_generic_params ( generics, item. span , & qualname[ .. ] , item. id ) ;
759
+ self . process_generic_params ( generics, item. span , & qualname, item. id ) ;
765
760
for method in methods {
766
761
self . visit_trait_item ( method)
767
762
}
@@ -1001,7 +996,7 @@ impl <'l, 'tcx> DumpCsvVisitor<'l, 'tcx> {
1001
996
self . cur_scope ) ;
1002
997
1003
998
// walk receiver and args
1004
- visit:: walk_exprs ( self , & args[ .. ] ) ;
999
+ visit:: walk_exprs ( self , & args) ;
1005
1000
}
1006
1001
1007
1002
fn process_pat ( & mut self , p : & ast:: Pat ) {
@@ -1160,7 +1155,7 @@ impl<'l, 'tcx, 'v> Visitor<'v> for DumpCsvVisitor<'l, 'tcx> {
1160
1155
item. id ,
1161
1156
cnum,
1162
1157
name,
1163
- & location[ .. ] ,
1158
+ & location,
1164
1159
self . cur_scope ) ;
1165
1160
}
1166
1161
ast:: ItemFn ( ref decl, _, _, _, ref ty_params, ref body) =>
@@ -1195,8 +1190,8 @@ impl<'l, 'tcx, 'v> Visitor<'v> for DumpCsvVisitor<'l, 'tcx> {
1195
1190
self . fmt . typedef_str ( item. span ,
1196
1191
sub_span,
1197
1192
item. id ,
1198
- & qualname[ .. ] ,
1199
- & value[ .. ] ) ;
1193
+ & qualname,
1194
+ & value) ;
1200
1195
1201
1196
self . visit_ty ( & * * ty) ;
1202
1197
self . process_generic_params ( ty_params, item. span , & qualname, item. id ) ;
@@ -1348,7 +1343,7 @@ impl<'l, 'tcx, 'v> Visitor<'v> for DumpCsvVisitor<'l, 'tcx> {
1348
1343
1349
1344
let mut id = String :: from_str ( "$" ) ;
1350
1345
id. push_str ( & ex. id . to_string ( ) ) ;
1351
- self . process_formals ( & decl. inputs , & id[ .. ] ) ;
1346
+ self . process_formals ( & decl. inputs , & id) ;
1352
1347
1353
1348
// walk arg and return types
1354
1349
for arg in & decl. inputs {
@@ -1408,7 +1403,7 @@ impl<'l, 'tcx, 'v> Visitor<'v> for DumpCsvVisitor<'l, 'tcx> {
1408
1403
Some ( p. span ) ,
1409
1404
id,
1410
1405
& path_to_string ( p) ,
1411
- & value[ .. ] ,
1406
+ & value,
1412
1407
"" )
1413
1408
}
1414
1409
def:: DefVariant ( ..) | def:: DefTy ( ..) | def:: DefStruct ( ..) => {
@@ -1466,8 +1461,8 @@ impl<'l, 'tcx, 'v> Visitor<'v> for DumpCsvVisitor<'l, 'tcx> {
1466
1461
sub_span,
1467
1462
id,
1468
1463
& path_to_string ( p) ,
1469
- & value[ .. ] ,
1470
- & typ[ .. ] ) ;
1464
+ & value,
1465
+ & typ) ;
1471
1466
}
1472
1467
1473
1468
// Just walk the initialiser and type (don't want to walk the pattern again).
0 commit comments