@@ -42,7 +42,7 @@ pub(crate) struct DebugContext {
42
42
namespace_map : DefIdMap < UnitEntryId > ,
43
43
array_size_type : UnitEntryId ,
44
44
45
- should_remap_filepaths : bool ,
45
+ filename_display_preference : FileNameDisplayPreference ,
46
46
}
47
47
48
48
pub ( crate ) struct FunctionDebugContext {
@@ -84,22 +84,18 @@ impl DebugContext {
84
84
85
85
let mut dwarf = DwarfUnit :: new ( encoding) ;
86
86
87
- let should_remap_filepaths = tcx. sess . should_prefer_remapped_for_codegen ( ) ;
87
+ use rustc_session:: config:: RemapPathScopeComponents ;
88
+
89
+ let filename_display_preference =
90
+ tcx. sess . filename_display_preference ( RemapPathScopeComponents :: DEBUGINFO ) ;
88
91
89
92
let producer = producer ( tcx. sess ) ;
90
- let comp_dir = tcx
91
- . sess
92
- . opts
93
- . working_dir
94
- . to_string_lossy ( if should_remap_filepaths {
95
- FileNameDisplayPreference :: Remapped
96
- } else {
97
- FileNameDisplayPreference :: Local
98
- } )
99
- . into_owned ( ) ;
93
+ let comp_dir =
94
+ tcx. sess . opts . working_dir . to_string_lossy ( filename_display_preference) . to_string ( ) ;
95
+
100
96
let ( name, file_info) = match tcx. sess . local_crate_source_file ( ) {
101
97
Some ( path) => {
102
- let name = path. to_string_lossy ( ) . into_owned ( ) ;
98
+ let name = path. to_string_lossy ( filename_display_preference ) . to_string ( ) ;
103
99
( name, None )
104
100
}
105
101
None => ( tcx. crate_name ( LOCAL_CRATE ) . to_string ( ) , None ) ,
@@ -156,7 +152,7 @@ impl DebugContext {
156
152
stack_pointer_register,
157
153
namespace_map : DefIdMap :: default ( ) ,
158
154
array_size_type,
159
- should_remap_filepaths ,
155
+ filename_display_preference ,
160
156
}
161
157
}
162
158
0 commit comments