Skip to content
This repository was archived by the owner on Dec 29, 2022. It is now read-only.

Commit 118eee2

Browse files
committed
Pick local path for working_dir and file paths
1 parent e33f4e6 commit 118eee2

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

rls-rustc/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ impl Callbacks for ShimCalls {
121121
let sess = compiler.session();
122122
let input = compiler.input();
123123

124-
let cwd = &sess.working_dir.0;
124+
let cwd = &sess.working_dir.local_path_if_available();
125125

126126
let src_path = match input {
127127
Input::File(ref name) => Some(name.to_path_buf()),
@@ -209,14 +209,14 @@ impl Callbacks for ShimCalls {
209209

210210
#[cfg(feature = "ipc")]
211211
fn fetch_input_files(sess: &rustc_session::Session) -> Vec<PathBuf> {
212-
let cwd = &sess.working_dir.0;
212+
let cwd = &sess.working_dir.local_path_if_available();
213213

214214
sess.source_map()
215215
.files()
216216
.iter()
217217
.filter(|fmap| fmap.is_real_file())
218218
.filter(|fmap| !fmap.is_imported())
219-
.map(|fmap| fmap.name.to_string())
219+
.map(|fmap| fmap.name.prefer_local().to_string())
220220
.map(|fmap| src_path(Some(cwd), fmap).unwrap())
221221
.collect()
222222
}

rls/src/build/rustc.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ impl rustc_driver::Callbacks for RlsRustcCalls {
239239
let input = compiler.input();
240240
let crate_name = queries.crate_name().unwrap().peek().clone();
241241

242-
let cwd = &sess.working_dir.0;
242+
let cwd = &sess.working_dir.local_path_if_available();
243243

244244
let src_path = match input {
245245
Input::File(ref name) => Some(name.to_path_buf()),
@@ -327,14 +327,14 @@ fn clippy_config(config: &mut interface::Config) {
327327
}
328328

329329
fn fetch_input_files(sess: &Session) -> Vec<PathBuf> {
330-
let cwd = &sess.working_dir.0;
330+
let cwd = &sess.working_dir.local_path_if_available();
331331

332332
sess.source_map()
333333
.files()
334334
.iter()
335335
.filter(|fmap| fmap.is_real_file())
336336
.filter(|fmap| !fmap.is_imported())
337-
.map(|fmap| fmap.name.to_string())
337+
.map(|fmap| fmap.name.prefer_local().to_string())
338338
.map(|fmap| src_path(Some(cwd), fmap).unwrap())
339339
.collect()
340340
}

0 commit comments

Comments
 (0)