about summary refs log tree commit diff
path: root/compiler/rustc_save_analysis/src/span_utils.rs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/rustc_save_analysis/src/span_utils.rs')
-rw-r--r--compiler/rustc_save_analysis/src/span_utils.rs14
1 files changed, 8 insertions, 6 deletions
diff --git a/compiler/rustc_save_analysis/src/span_utils.rs b/compiler/rustc_save_analysis/src/span_utils.rs
index edcd4925773..1947b04f441 100644
--- a/compiler/rustc_save_analysis/src/span_utils.rs
+++ b/compiler/rustc_save_analysis/src/span_utils.rs
@@ -16,8 +16,7 @@ impl<'a> SpanUtils<'a> {
 
     pub fn make_filename_string(&self, file: &SourceFile) -> String {
         match &file.name {
-            FileName::Real(name) if !file.name_was_remapped => {
-                let path = name.local_path();
+            FileName::Real(RealFileName::LocalPath(path)) => {
                 if path.is_absolute() {
                     self.sess
                         .source_map()
@@ -27,12 +26,15 @@ impl<'a> SpanUtils<'a> {
                         .display()
                         .to_string()
                 } else {
-                    self.sess.working_dir.0.join(&path).display().to_string()
+                    self.sess
+                        .working_dir
+                        .remapped_path_if_available()
+                        .join(&path)
+                        .display()
+                        .to_string()
                 }
             }
-            // If the file name is already remapped, we assume the user
-            // configured it the way they wanted to, so use that directly
-            filename => filename.to_string(),
+            filename => filename.prefer_remapped().to_string(),
         }
     }