Skip to content

Commit

Permalink
Account for --remap-path-prefix in save-analysis
Browse files Browse the repository at this point in the history
  • Loading branch information
Xanewok committed Aug 6, 2018
1 parent 7c98d2e commit e8bb7bf
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/librustc_save_analysis/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> {
result.push(ExternalCrateData {
// FIXME: change file_name field to PathBuf in rls-data
// https://github.com/nrc/rls-data/issues/7
file_name: SpanUtils::make_path_string(&lo_loc.file.name),
file_name: self.span_utils.make_path_string(&lo_loc.file.name),
num: n.as_u32(),
id: GlobalCrateId {
name: self.tcx.crate_name(n).to_string(),
Expand Down
6 changes: 2 additions & 4 deletions src/librustc_save_analysis/span_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ use rustc::session::Session;
use generated_code;

use std::cell::Cell;
use std::env;

use syntax::parse::lexer::{self, StringReader};
use syntax::parse::token::{self, Token};
Expand All @@ -36,11 +35,10 @@ impl<'a> SpanUtils<'a> {
}
}

pub fn make_path_string(path: &FileName) -> String {
pub fn make_path_string(&self, path: &FileName) -> String {
match *path {
FileName::Real(ref path) if !path.is_absolute() =>
env::current_dir()
.unwrap()
self.sess.working_dir.0
.join(&path)
.display()
.to_string(),
Expand Down

0 comments on commit e8bb7bf

Please sign in to comment.