@@ -708,7 +708,7 @@ impl <'l, 'tcx> DumpCsvVisitor<'l, 'tcx> {
708
708
& val) ;
709
709
710
710
// super-traits
711
- for super_bound in & trait_refs {
711
+ for super_bound in trait_refs. iter ( ) {
712
712
let trait_ref = match * super_bound {
713
713
ast:: TraitTyParamBound ( ref trait_ref, _) => {
714
714
trait_ref
@@ -882,44 +882,35 @@ impl <'l, 'tcx> DumpCsvVisitor<'l, 'tcx> {
882
882
883
883
self . write_sub_paths_truncated ( path, false ) ;
884
884
885
- let ty = & ty:: expr_ty_adjusted ( & self . analysis . ty_cx , ex) . sty ;
886
- let struct_def = match * ty {
887
- ty:: TyStruct ( def_id, _) => {
888
- let sub_span = self . span . span_for_last_ident ( path. span ) ;
889
- self . fmt . ref_str ( recorder:: TypeRef ,
890
- path. span ,
891
- sub_span,
892
- def_id,
893
- self . cur_scope ) ;
894
- Some ( def_id)
895
- }
896
- _ => None
885
+ let struct_lit_data = self . save_ctxt . get_expr_data ( ex) ;
886
+ let struct_def = if let super :: Data :: TypeRefData ( struct_lit_data) = struct_lit_data {
887
+ self . fmt . ref_str ( recorder:: TypeRef ,
888
+ ex. span ,
889
+ Some ( struct_lit_data. span ) ,
890
+ struct_lit_data. ref_id ,
891
+ struct_lit_data. scope ) ;
892
+ struct_lit_data. ref_id
893
+ } else {
894
+ self . sess . span_bug ( ex. span , "expected TypeRefData" ) ;
897
895
} ;
898
896
899
897
for field in fields {
900
- match struct_def {
901
- Some ( struct_def) => {
902
- let fields = ty:: lookup_struct_fields ( & self . analysis . ty_cx , struct_def) ;
903
- for f in & fields {
904
- if generated_code ( field. ident . span ) {
905
- continue ;
906
- }
907
- if f. name == field. ident . node . name {
908
- // We don't really need a sub-span here, but no harm done
909
- let sub_span = self . span . span_for_last_ident ( field. ident . span ) ;
910
- self . fmt . ref_str ( recorder:: VarRef ,
911
- field. ident . span ,
912
- sub_span,
913
- f. id ,
914
- self . cur_scope ) ;
915
- }
916
- }
917
- }
918
- None => { }
898
+ if generated_code ( field. ident . span ) {
899
+ continue ;
919
900
}
920
901
902
+ let field_data = self . save_ctxt . get_field_ref_data ( field,
903
+ struct_def,
904
+ self . cur_scope ) ;
905
+ self . fmt . ref_str ( recorder:: VarRef ,
906
+ field. ident . span ,
907
+ Some ( field_data. span ) ,
908
+ field_data. ref_id ,
909
+ field_data. scope ) ;
910
+
921
911
self . visit_expr ( & field. expr )
922
912
}
913
+
923
914
visit:: walk_expr_opt ( self , base)
924
915
}
925
916
0 commit comments