From 118eee228040f67d2c990d3d5f692187ff4eb95e Mon Sep 17 00:00:00 2001 From: Andy Wang Date: Wed, 12 May 2021 23:30:56 +0100 Subject: [PATCH 1/2] Pick local path for working_dir and file paths --- rls-rustc/src/lib.rs | 6 +++--- rls/src/build/rustc.rs | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/rls-rustc/src/lib.rs b/rls-rustc/src/lib.rs index 9dd21175cf..6ed166fef9 100644 --- a/rls-rustc/src/lib.rs +++ b/rls-rustc/src/lib.rs @@ -121,7 +121,7 @@ impl Callbacks for ShimCalls { let sess = compiler.session(); let input = compiler.input(); - let cwd = &sess.working_dir.0; + let cwd = &sess.working_dir.local_path_if_available(); let src_path = match input { Input::File(ref name) => Some(name.to_path_buf()), @@ -209,14 +209,14 @@ impl Callbacks for ShimCalls { #[cfg(feature = "ipc")] fn fetch_input_files(sess: &rustc_session::Session) -> Vec { - let cwd = &sess.working_dir.0; + let cwd = &sess.working_dir.local_path_if_available(); sess.source_map() .files() .iter() .filter(|fmap| fmap.is_real_file()) .filter(|fmap| !fmap.is_imported()) - .map(|fmap| fmap.name.to_string()) + .map(|fmap| fmap.name.prefer_local().to_string()) .map(|fmap| src_path(Some(cwd), fmap).unwrap()) .collect() } diff --git a/rls/src/build/rustc.rs b/rls/src/build/rustc.rs index c7562e19fd..e35cbf6e84 100644 --- a/rls/src/build/rustc.rs +++ b/rls/src/build/rustc.rs @@ -239,7 +239,7 @@ impl rustc_driver::Callbacks for RlsRustcCalls { let input = compiler.input(); let crate_name = queries.crate_name().unwrap().peek().clone(); - let cwd = &sess.working_dir.0; + let cwd = &sess.working_dir.local_path_if_available(); let src_path = match input { Input::File(ref name) => Some(name.to_path_buf()), @@ -327,14 +327,14 @@ fn clippy_config(config: &mut interface::Config) { } fn fetch_input_files(sess: &Session) -> Vec { - let cwd = &sess.working_dir.0; + let cwd = &sess.working_dir.local_path_if_available(); sess.source_map() .files() .iter() .filter(|fmap| fmap.is_real_file()) .filter(|fmap| !fmap.is_imported()) - .map(|fmap| fmap.name.to_string()) + .map(|fmap| fmap.name.prefer_local().to_string()) .map(|fmap| src_path(Some(cwd), fmap).unwrap()) .collect() } From 9fae6994a59354e7907840432575bf04fe4c9d90 Mon Sep 17 00:00:00 2001 From: Andy Wang Date: Thu, 13 May 2021 08:50:33 +0100 Subject: [PATCH 2/2] Bump rustfmt commit --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 158c198ab1..0763cd40df 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2403,7 +2403,7 @@ dependencies = [ [[package]] name = "rustfmt-config_proc_macro" version = "0.2.0" -source = "git+https://github.com/rust-lang/rustfmt?rev=2a3635d5d1218c726ff58af4bc35418836143f69#2a3635d5d1218c726ff58af4bc35418836143f69" +source = "git+https://github.com/rust-lang/rustfmt?rev=927561ace1ef9485206a9e6a9482e39fb3e1f31b#927561ace1ef9485206a9e6a9482e39fb3e1f31b" dependencies = [ "proc-macro2", "quote", @@ -2413,7 +2413,7 @@ dependencies = [ [[package]] name = "rustfmt-nightly" version = "1.4.37" -source = "git+https://github.com/rust-lang/rustfmt?rev=2a3635d5d1218c726ff58af4bc35418836143f69#2a3635d5d1218c726ff58af4bc35418836143f69" +source = "git+https://github.com/rust-lang/rustfmt?rev=927561ace1ef9485206a9e6a9482e39fb3e1f31b#927561ace1ef9485206a9e6a9482e39fb3e1f31b" dependencies = [ "annotate-snippets", "anyhow", diff --git a/Cargo.toml b/Cargo.toml index a2878b82bf..b29be2e351 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -47,7 +47,7 @@ racer = { version = "2.1.46", default-features = false } rand = "0.7" rayon = "1" rustc_tools_util = "0.2" -rustfmt-nightly = { git = "https://github.com/rust-lang/rustfmt", rev = "2a3635d5d1218c726ff58af4bc35418836143f69" } +rustfmt-nightly = { git = "https://github.com/rust-lang/rustfmt", rev = "927561ace1ef9485206a9e6a9482e39fb3e1f31b" } serde = "1.0" serde_json = "1.0" serde_derive = "1.0"