Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Account for --remap-path-prefix in save-analysis #53110

Merged
merged 1 commit into from
Aug 9, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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