Skip to content

Commit e35ca13

Browse files
authored
Rollup merge of rust-lang#53110 - Xanewok:save-analysis-remap-path, r=nrc
Account for --remap-path-prefix in save-analysis Fixes rust-lang#52549. Didn't add a test since save-analysis is still unstable, only tested this locally. Should I add a test for that? If so, is run-make-fulldeps an appropriate format? Session is already created with remapped working directory, so use that instead of the actual cwd. This was the only place affected, since the rest of the paths in save-analysis are directly derived from files in spans from `sess.codemap()`, which already creates remapped ones. r? @nrc
2 parents c346391 + e8bb7bf commit e35ca13

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

src/librustc_save_analysis/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> {
125125
result.push(ExternalCrateData {
126126
// FIXME: change file_name field to PathBuf in rls-data
127127
// https://github.com/nrc/rls-data/issues/7
128-
file_name: SpanUtils::make_path_string(&lo_loc.file.name),
128+
file_name: self.span_utils.make_path_string(&lo_loc.file.name),
129129
num: n.as_u32(),
130130
id: GlobalCrateId {
131131
name: self.tcx.crate_name(n).to_string(),

src/librustc_save_analysis/span_utils.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ use rustc::session::Session;
1313
use generated_code;
1414

1515
use std::cell::Cell;
16-
use std::env;
1716

1817
use syntax::parse::lexer::{self, StringReader};
1918
use syntax::parse::token::{self, Token};
@@ -36,11 +35,10 @@ impl<'a> SpanUtils<'a> {
3635
}
3736
}
3837

39-
pub fn make_path_string(path: &FileName) -> String {
38+
pub fn make_path_string(&self, path: &FileName) -> String {
4039
match *path {
4140
FileName::Real(ref path) if !path.is_absolute() =>
42-
env::current_dir()
43-
.unwrap()
41+
self.sess.working_dir.0
4442
.join(&path)
4543
.display()
4644
.to_string(),

0 commit comments

Comments
 (0)