@@ -42,7 +42,7 @@ pub(crate) struct DebugContext {
4242 namespace_map : DefIdMap < UnitEntryId > ,
4343 array_size_type : UnitEntryId ,
4444
45- should_remap_filepaths : bool ,
45+ filename_display_preference : FileNameDisplayPreference ,
4646}
4747
4848pub ( crate ) struct FunctionDebugContext {
@@ -85,26 +85,17 @@ impl DebugContext {
8585 let mut dwarf = DwarfUnit :: new ( encoding) ;
8686
8787 use rustc_session:: config:: RemapPathScopeComponents ;
88- use rustc_session:: RemapFileNameExt ;
8988
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 ) ;
9291
9392 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 ( ) ;
10195
10296 let ( name, file_info) = match tcx. sess . local_crate_source_file ( ) {
10397 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 ( ) ;
10899 ( name, None )
109100 }
110101 None => ( tcx. crate_name ( LOCAL_CRATE ) . to_string ( ) , None ) ,
@@ -161,7 +152,7 @@ impl DebugContext {
161152 stack_pointer_register,
162153 namespace_map : DefIdMap :: default ( ) ,
163154 array_size_type,
164- should_remap_filepaths ,
155+ filename_display_preference ,
165156 }
166157 }
167158
0 commit comments