about summary refs log tree commit diff
path: root/compiler/rustc_codegen_cranelift/src/debuginfo/mod.rs
diff options
context:
space:
mode:
authorThe Miri Cronjob Bot <miri@cron.bot>2024-03-30 05:23:38 +0000
committerThe Miri Cronjob Bot <miri@cron.bot>2024-03-30 05:23:38 +0000
commit28521fd2eb40339a20e10c124e60b5efbc31e17b (patch)
tree90d2cf40dac38eaa763ff4df5c514b0f86b4b40e /compiler/rustc_codegen_cranelift/src/debuginfo/mod.rs
parentfee9a8eab8f1ae85135f2de7bf8bee815e364665 (diff)
parent69fa40cb48384fad7930dce2d9a20d18fe4d1b51 (diff)
Merge from rustc
Diffstat (limited to 'compiler/rustc_codegen_cranelift/src/debuginfo/mod.rs')
-rw-r--r--compiler/rustc_codegen_cranelift/src/debuginfo/mod.rs24
1 files changed, 10 insertions, 14 deletions
diff --git a/compiler/rustc_codegen_cranelift/src/debuginfo/mod.rs b/compiler/rustc_codegen_cranelift/src/debuginfo/mod.rs
index 1bb0e590513..5d943b5d996 100644
--- a/compiler/rustc_codegen_cranelift/src/debuginfo/mod.rs
+++ b/compiler/rustc_codegen_cranelift/src/debuginfo/mod.rs
@@ -42,7 +42,7 @@ pub(crate) struct DebugContext {
     namespace_map: DefIdMap<UnitEntryId>,
     array_size_type: UnitEntryId,
 
-    should_remap_filepaths: bool,
+    filename_display_preference: FileNameDisplayPreference,
 }
 
 pub(crate) struct FunctionDebugContext {
@@ -84,22 +84,18 @@ impl DebugContext {
 
         let mut dwarf = DwarfUnit::new(encoding);
 
-        let should_remap_filepaths = tcx.sess.should_prefer_remapped_for_codegen();
+        use rustc_session::config::RemapPathScopeComponents;
+
+        let filename_display_preference =
+            tcx.sess.filename_display_preference(RemapPathScopeComponents::DEBUGINFO);
 
         let producer = producer(tcx.sess);
-        let comp_dir = tcx
-            .sess
-            .opts
-            .working_dir
-            .to_string_lossy(if should_remap_filepaths {
-                FileNameDisplayPreference::Remapped
-            } else {
-                FileNameDisplayPreference::Local
-            })
-            .into_owned();
+        let comp_dir =
+            tcx.sess.opts.working_dir.to_string_lossy(filename_display_preference).to_string();
+
         let (name, file_info) = match tcx.sess.local_crate_source_file() {
             Some(path) => {
-                let name = path.to_string_lossy().into_owned();
+                let name = path.to_string_lossy(filename_display_preference).to_string();
                 (name, None)
             }
             None => (tcx.crate_name(LOCAL_CRATE).to_string(), None),
@@ -156,7 +152,7 @@ impl DebugContext {
             stack_pointer_register,
             namespace_map: DefIdMap::default(),
             array_size_type,
-            should_remap_filepaths,
+            filename_display_preference,
         }
     }