about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorUrgau <urgau@numericable.fr>2024-03-21 21:13:06 +0100
committerUrgau <urgau@numericable.fr>2024-03-28 18:47:26 +0100
commit6a2b2b43bd65ee7e3def7e10289bb98ca415dc03 (patch)
treebf406a95f411567ab64e99b78e979f54be36a00b /src
parentd6a817a7d9b8950cf73914d17cfc1c8e35dc2c7f (diff)
downloadrust-6a2b2b43bd65ee7e3def7e10289bb98ca415dc03.tar.gz
rust-6a2b2b43bd65ee7e3def7e10289bb98ca415dc03.zip
Introduce `FileNameMapping::to_real_filename` and use it everywhere
Diffstat (limited to 'src')
-rw-r--r--src/debuginfo/mod.rs20
1 files changed, 8 insertions, 12 deletions
diff --git a/src/debuginfo/mod.rs b/src/debuginfo/mod.rs
index 222dc56a2b1..b661fa185b8 100644
--- a/src/debuginfo/mod.rs
+++ b/src/debuginfo/mod.rs
@@ -85,6 +85,8 @@ impl DebugContext {
         let mut dwarf = DwarfUnit::new(encoding);
 
         use rustc_session::config::RemapPathScopeComponents;
+        use rustc_session::RemapFileNameExt;
+
         let should_remap_filepaths =
             tcx.sess.should_prefer_remapped(RemapPathScopeComponents::DEBUGINFO);
 
@@ -93,22 +95,16 @@ impl DebugContext {
             .sess
             .opts
             .working_dir
-            .to_string_lossy(if should_remap_filepaths {
-                FileNameDisplayPreference::Remapped
-            } else {
-                FileNameDisplayPreference::Local
-            })
-            .into_owned();
+            .for_scope(tcx.sess, RemapPathScopeComponents::DEBUGINFO)
+            .to_string_lossy()
+            .to_string();
 
         let (name, file_info) = match tcx.sess.local_crate_source_file() {
             Some(path) => {
                 let name = path
-                    .to_string_lossy(if should_remap_filepaths {
-                        FileNameDisplayPreference::Remapped
-                    } else {
-                        FileNameDisplayPreference::Local
-                    })
-                    .into_owned();
+                    .for_scope(tcx.sess, RemapPathScopeComponents::DEBUGINFO)
+                    .to_string_lossy()
+                    .to_string();
                 (name, None)
             }
             None => (tcx.crate_name(LOCAL_CRATE).to_string(), None),