@@ -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 {
@@ -85,26 +85,17 @@ impl DebugContext {
85
85
let mut dwarf = DwarfUnit :: new ( encoding) ;
86
86
87
87
use rustc_session:: config:: RemapPathScopeComponents ;
88
- use rustc_session:: RemapFileNameExt ;
89
88
90
- let should_remap_filepaths =
91
- tcx. sess . should_prefer_remapped ( RemapPathScopeComponents :: DEBUGINFO ) ;
89
+ let filename_display_preference =
90
+ tcx. sess . filename_display_preference ( RemapPathScopeComponents :: DEBUGINFO ) ;
92
91
93
92
let producer = producer ( tcx. sess ) ;
94
- let comp_dir = tcx
95
- . sess
96
- . opts
97
- . working_dir
98
- . for_scope ( tcx. sess , RemapPathScopeComponents :: DEBUGINFO )
99
- . to_string_lossy ( )
100
- . to_string ( ) ;
93
+ let comp_dir =
94
+ tcx. sess . opts . working_dir . to_string_lossy ( filename_display_preference) . to_string ( ) ;
101
95
102
96
let ( name, file_info) = match tcx. sess . local_crate_source_file ( ) {
103
97
Some ( path) => {
104
- let name = path
105
- . for_scope ( tcx. sess , RemapPathScopeComponents :: DEBUGINFO )
106
- . to_string_lossy ( )
107
- . to_string ( ) ;
98
+ let name = path. to_string_lossy ( filename_display_preference) . to_string ( ) ;
108
99
( name, None )
109
100
}
110
101
None => ( tcx. crate_name ( LOCAL_CRATE ) . to_string ( ) , None ) ,
@@ -161,7 +152,7 @@ impl DebugContext {
161
152
stack_pointer_register,
162
153
namespace_map : DefIdMap :: default ( ) ,
163
154
array_size_type,
164
- should_remap_filepaths ,
155
+ filename_display_preference ,
165
156
}
166
157
}
167
158
0 commit comments