Skip to content

Commit 3ceae8d

Browse files
committed
Also remap absolute source names in save-analysis
1 parent 24123dd commit 3ceae8d

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

Diff for: src/librustc_save_analysis/span_utils.rs

+12-5
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,18 @@ impl<'a> SpanUtils<'a> {
3737

3838
pub fn make_filename_string(&self, file: &SourceFile) -> String {
3939
match &file.name {
40-
FileName::Real(path) if !path.is_absolute() && !file.name_was_remapped => {
41-
self.sess.working_dir.0
42-
.join(&path)
43-
.display()
44-
.to_string()
40+
FileName::Real(path) if !file.name_was_remapped => {
41+
if path.is_absolute() {
42+
self.sess.source_map().path_mapping()
43+
.map_prefix(path.clone()).0
44+
.display()
45+
.to_string()
46+
} else {
47+
self.sess.working_dir.0
48+
.join(&path)
49+
.display()
50+
.to_string()
51+
}
4552
},
4653
// If the file name is already remapped, we assume the user
4754
// configured it the way they wanted to, so use that directly

0 commit comments

Comments
 (0)