@@ -46,7 +46,7 @@ use rustc::hir::def::Def as HirDef;
4646use rustc:: hir:: Node ;
4747use rustc:: hir:: def_id:: { DefId , LOCAL_CRATE } ;
4848use rustc:: middle:: cstore:: ExternCrate ;
49- use rustc:: session:: config:: { CrateType , OutputType } ;
49+ use rustc:: session:: config:: { CrateType , Input , OutputType } ;
5050use rustc:: ty:: { self , TyCtxt } ;
5151use rustc_typeck:: hir_ty_to_ty;
5252use rustc_codegen_utils:: link:: { filename_for_metadata, out_filename} ;
@@ -74,7 +74,7 @@ use span_utils::SpanUtils;
7474
7575use rls_data:: config:: Config ;
7676use rls_data:: {
77- CrateSource , Def , DefKind , ExternalCrateData , GlobalCrateId , Impl , ImplKind , MacroRef , Ref ,
77+ Def , DefKind , ExternalCrateData , GlobalCrateId , Impl , ImplKind , MacroRef , Ref ,
7878 RefKind , Relation , RelationKind , SpanData ,
7979} ;
8080
@@ -143,11 +143,7 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> {
143143 continue ;
144144 }
145145 } ;
146- let src = self . tcx . used_crate_source ( n) ;
147146 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- } ;
151147
152148 result. push ( ExternalCrateData {
153149 // FIXME: change file_name field to PathBuf in rls-data
@@ -158,11 +154,6 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> {
158154 name : self . tcx . crate_name ( n) . to_string ( ) ,
159155 disambiguator : self . tcx . crate_disambiguator ( n) . to_fingerprint ( ) . as_value ( ) ,
160156 } ,
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- }
166157 } ) ;
167158 }
168159
@@ -1046,6 +1037,7 @@ pub trait SaveHandler {
10461037 save_ctxt : SaveContext < ' l , ' tcx > ,
10471038 krate : & ast:: Crate ,
10481039 cratename : & str ,
1040+ input : & ' l Input ,
10491041 ) ;
10501042}
10511043
@@ -1111,13 +1103,14 @@ impl<'a> SaveHandler for DumpHandler<'a> {
11111103 save_ctxt : SaveContext < ' l , ' tcx > ,
11121104 krate : & ast:: Crate ,
11131105 cratename : & str ,
1106+ input : & ' l Input ,
11141107 ) {
11151108 let output = & mut self . output_file ( & save_ctxt) ;
11161109 let mut dumper = JsonDumper :: new ( output, save_ctxt. config . clone ( ) ) ;
11171110 let mut visitor = DumpVisitor :: new ( save_ctxt, & mut dumper) ;
11181111
11191112 visitor. dump_crate_info ( cratename, krate) ;
1120- visitor. dump_compilation_options ( cratename) ;
1113+ visitor. dump_compilation_options ( input , cratename) ;
11211114 visit:: walk_crate ( & mut visitor, krate) ;
11221115 }
11231116}
@@ -1133,6 +1126,7 @@ impl<'b> SaveHandler for CallbackHandler<'b> {
11331126 save_ctxt : SaveContext < ' l , ' tcx > ,
11341127 krate : & ast:: Crate ,
11351128 cratename : & str ,
1129+ input : & ' l Input ,
11361130 ) {
11371131 // We're using the JsonDumper here because it has the format of the
11381132 // save-analysis results that we will pass to the callback. IOW, we are
@@ -1143,7 +1137,7 @@ impl<'b> SaveHandler for CallbackHandler<'b> {
11431137 let mut visitor = DumpVisitor :: new ( save_ctxt, & mut dumper) ;
11441138
11451139 visitor. dump_crate_info ( cratename, krate) ;
1146- visitor. dump_compilation_options ( cratename) ;
1140+ visitor. dump_compilation_options ( input , cratename) ;
11471141 visit:: walk_crate ( & mut visitor, krate) ;
11481142 }
11491143}
@@ -1153,6 +1147,7 @@ pub fn process_crate<'l, 'tcx, H: SaveHandler>(
11531147 krate : & ast:: Crate ,
11541148 analysis : & ' l ty:: CrateAnalysis ,
11551149 cratename : & str ,
1150+ input : & ' l Input ,
11561151 config : Option < Config > ,
11571152 mut handler : H ,
11581153) {
@@ -1170,7 +1165,7 @@ pub fn process_crate<'l, 'tcx, H: SaveHandler>(
11701165 impl_counter : Cell :: new ( 0 ) ,
11711166 } ;
11721167
1173- handler. save ( save_ctxt, krate, cratename)
1168+ handler. save ( save_ctxt, krate, cratename, input )
11741169 } )
11751170}
11761171
0 commit comments