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

Commit 074c8f5

Browse files
committed
Auto merge of #1736 - cbeuw:83813, r=Xanewok
Sync with rustc_span changes rust-lang/rust#83813 made some changes to SourceMap and RealFileName. Now to get a string from a `rustc_span::FileName` or `RealFileName` (`working_dir` in `rustc_span::Session` is now a `RealFileName` because it may be remapped), we need to specify if we would like the local filesystem path or remapped path via `--remap-path-prefix`. There are two files affected, the context very similar in both. I'm not entirely sure if we want the local path or remapped path here, so I just picked local path as a placeholder for opening this PR. Closes - after updating rls module in rustc repo - rust-lang/rust#85225
2 parents e33f4e6 + 9fae699 commit 074c8f5

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

Cargo.lock

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ racer = { version = "2.1.46", default-features = false }
4747
rand = "0.7"
4848
rayon = "1"
4949
rustc_tools_util = "0.2"
50-
rustfmt-nightly = { git = "https://github.com/rust-lang/rustfmt", rev = "2a3635d5d1218c726ff58af4bc35418836143f69" }
50+
rustfmt-nightly = { git = "https://github.com/rust-lang/rustfmt", rev = "927561ace1ef9485206a9e6a9482e39fb3e1f31b" }
5151
serde = "1.0"
5252
serde_json = "1.0"
5353
serde_derive = "1.0"

rls-rustc/src/lib.rs

+3-3
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

+3-3
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)