@@ -46,7 +46,7 @@ use rustc::hir::def::Def as HirDef;
46
46
use rustc:: hir:: Node ;
47
47
use rustc:: hir:: def_id:: { DefId , LOCAL_CRATE } ;
48
48
use rustc:: middle:: cstore:: ExternCrate ;
49
- use rustc:: session:: config:: { CrateType , OutputType } ;
49
+ use rustc:: session:: config:: { CrateType , Input , OutputType } ;
50
50
use rustc:: ty:: { self , TyCtxt } ;
51
51
use rustc_typeck:: hir_ty_to_ty;
52
52
use rustc_codegen_utils:: link:: { filename_for_metadata, out_filename} ;
@@ -74,7 +74,7 @@ use span_utils::SpanUtils;
74
74
75
75
use rls_data:: config:: Config ;
76
76
use rls_data:: {
77
- CrateSource , Def , DefKind , ExternalCrateData , GlobalCrateId , Impl , ImplKind , MacroRef , Ref ,
77
+ Def , DefKind , ExternalCrateData , GlobalCrateId , Impl , ImplKind , MacroRef , Ref ,
78
78
RefKind , Relation , RelationKind , SpanData ,
79
79
} ;
80
80
@@ -143,11 +143,7 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> {
143
143
continue ;
144
144
}
145
145
} ;
146
- let src = self . tcx . used_crate_source ( n) ;
147
146
let lo_loc = self . span_utils . sess . source_map ( ) . lookup_char_pos ( span. lo ( ) ) ;
148
- let map_prefix = |path : & PathBuf | -> PathBuf {
149
- self . tcx . sess . source_map ( ) . path_mapping ( ) . map_prefix ( path. to_owned ( ) ) . 0
150
- } ;
151
147
152
148
result. push ( ExternalCrateData {
153
149
// FIXME: change file_name field to PathBuf in rls-data
@@ -158,11 +154,6 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> {
158
154
name : self . tcx . crate_name ( n) . to_string ( ) ,
159
155
disambiguator : self . tcx . crate_disambiguator ( n) . to_fingerprint ( ) . as_value ( ) ,
160
156
} ,
161
- source : CrateSource {
162
- dylib : src. dylib . as_ref ( ) . map ( |( path, _) | map_prefix ( path) ) ,
163
- rlib : src. rlib . as_ref ( ) . map ( |( path, _) | map_prefix ( path) ) ,
164
- rmeta : src. rmeta . as_ref ( ) . map ( |( path, _) | map_prefix ( path) ) ,
165
- }
166
157
} ) ;
167
158
}
168
159
@@ -1046,6 +1037,7 @@ pub trait SaveHandler {
1046
1037
save_ctxt : SaveContext < ' l , ' tcx > ,
1047
1038
krate : & ast:: Crate ,
1048
1039
cratename : & str ,
1040
+ input : & ' l Input ,
1049
1041
) ;
1050
1042
}
1051
1043
@@ -1111,13 +1103,14 @@ impl<'a> SaveHandler for DumpHandler<'a> {
1111
1103
save_ctxt : SaveContext < ' l , ' tcx > ,
1112
1104
krate : & ast:: Crate ,
1113
1105
cratename : & str ,
1106
+ input : & ' l Input ,
1114
1107
) {
1115
1108
let output = & mut self . output_file ( & save_ctxt) ;
1116
1109
let mut dumper = JsonDumper :: new ( output, save_ctxt. config . clone ( ) ) ;
1117
1110
let mut visitor = DumpVisitor :: new ( save_ctxt, & mut dumper) ;
1118
1111
1119
1112
visitor. dump_crate_info ( cratename, krate) ;
1120
- visitor. dump_compilation_options ( cratename) ;
1113
+ visitor. dump_compilation_options ( input , cratename) ;
1121
1114
visit:: walk_crate ( & mut visitor, krate) ;
1122
1115
}
1123
1116
}
@@ -1133,6 +1126,7 @@ impl<'b> SaveHandler for CallbackHandler<'b> {
1133
1126
save_ctxt : SaveContext < ' l , ' tcx > ,
1134
1127
krate : & ast:: Crate ,
1135
1128
cratename : & str ,
1129
+ input : & ' l Input ,
1136
1130
) {
1137
1131
// We're using the JsonDumper here because it has the format of the
1138
1132
// save-analysis results that we will pass to the callback. IOW, we are
@@ -1143,7 +1137,7 @@ impl<'b> SaveHandler for CallbackHandler<'b> {
1143
1137
let mut visitor = DumpVisitor :: new ( save_ctxt, & mut dumper) ;
1144
1138
1145
1139
visitor. dump_crate_info ( cratename, krate) ;
1146
- visitor. dump_compilation_options ( cratename) ;
1140
+ visitor. dump_compilation_options ( input , cratename) ;
1147
1141
visit:: walk_crate ( & mut visitor, krate) ;
1148
1142
}
1149
1143
}
@@ -1153,6 +1147,7 @@ pub fn process_crate<'l, 'tcx, H: SaveHandler>(
1153
1147
krate : & ast:: Crate ,
1154
1148
analysis : & ' l ty:: CrateAnalysis ,
1155
1149
cratename : & str ,
1150
+ input : & ' l Input ,
1156
1151
config : Option < Config > ,
1157
1152
mut handler : H ,
1158
1153
) {
@@ -1170,7 +1165,7 @@ pub fn process_crate<'l, 'tcx, H: SaveHandler>(
1170
1165
impl_counter : Cell :: new ( 0 ) ,
1171
1166
} ;
1172
1167
1173
- handler. save ( save_ctxt, krate, cratename)
1168
+ handler. save ( save_ctxt, krate, cratename, input )
1174
1169
} )
1175
1170
}
1176
1171
0 commit comments