about summary refs log tree commit diff
path: root/compiler/rustc_codegen_cranelift/src/debuginfo/mod.rs
diff options
context:
space:
mode:
authorUrgau <urgau@numericable.fr>2024-03-22 15:27:17 +0100
committerUrgau <urgau@numericable.fr>2024-03-28 18:47:26 +0100
commitfefb8f1f9cb830e1ca0b0ba449db7c8e7d4ff7ba (patch)
treeb768c3b57ac8013ca10494c76b2a5ad85f9908b1 /compiler/rustc_codegen_cranelift/src/debuginfo/mod.rs
parent4f4fa42b0ee1cf6c988d3f7ed6bcb4a51e788282 (diff)
downloadrust-fefb8f1f9cb830e1ca0b0ba449db7c8e7d4ff7ba.tar.gz
rust-fefb8f1f9cb830e1ca0b0ba449db7c8e7d4ff7ba.zip
Replace Session should_remap_filepaths with filename_display_preference
Diffstat (limited to 'compiler/rustc_codegen_cranelift/src/debuginfo/mod.rs')
-rw-r--r--compiler/rustc_codegen_cranelift/src/debuginfo/mod.rs23
1 files changed, 7 insertions, 16 deletions
diff --git a/compiler/rustc_codegen_cranelift/src/debuginfo/mod.rs b/compiler/rustc_codegen_cranelift/src/debuginfo/mod.rs
index b661fa185b8..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 {
@@ -85,26 +85,17 @@ 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);
+        let filename_display_preference =
+            tcx.sess.filename_display_preference(RemapPathScopeComponents::DEBUGINFO);
 
         let producer = producer(tcx.sess);
-        let comp_dir = tcx
-            .sess
-            .opts
-            .working_dir
-            .for_scope(tcx.sess, RemapPathScopeComponents::DEBUGINFO)
-            .to_string_lossy()
-            .to_string();
+        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
-                    .for_scope(tcx.sess, RemapPathScopeComponents::DEBUGINFO)
-                    .to_string_lossy()
-                    .to_string();
+                let name = path.to_string_lossy(filename_display_preference).to_string();
                 (name, None)
             }
             None => (tcx.crate_name(LOCAL_CRATE).to_string(), None),
@@ -161,7 +152,7 @@ impl DebugContext {
             stack_pointer_register,
             namespace_map: DefIdMap::default(),
             array_size_type,
-            should_remap_filepaths,
+            filename_display_preference,
         }
     }