@@ -29,7 +29,7 @@ pub(crate) struct DebugContext {
2929 dwarf : DwarfUnit ,
3030 unit_range_list : RangeList ,
3131
32- should_remap_filepaths : bool ,
32+ filename_display_preference : FileNameDisplayPreference ,
3333}
3434
3535pub ( crate ) struct FunctionDebugContext {
@@ -63,26 +63,17 @@ impl DebugContext {
6363 let mut dwarf = DwarfUnit :: new ( encoding) ;
6464
6565 use rustc_session:: config:: RemapPathScopeComponents ;
66- use rustc_session:: RemapFileNameExt ;
6766
68- let should_remap_filepaths =
69- tcx. sess . should_prefer_remapped ( RemapPathScopeComponents :: DEBUGINFO ) ;
67+ let filename_display_preference =
68+ tcx. sess . filename_display_preference ( RemapPathScopeComponents :: DEBUGINFO ) ;
7069
7170 let producer = producer ( tcx. sess ) ;
72- let comp_dir = tcx
73- . sess
74- . opts
75- . working_dir
76- . for_scope ( tcx. sess , RemapPathScopeComponents :: DEBUGINFO )
77- . to_string_lossy ( )
78- . to_string ( ) ;
71+ let comp_dir =
72+ tcx. sess . opts . working_dir . to_string_lossy ( filename_display_preference) . to_string ( ) ;
7973
8074 let ( name, file_info) = match tcx. sess . local_crate_source_file ( ) {
8175 Some ( path) => {
82- let name = path
83- . for_scope ( tcx. sess , RemapPathScopeComponents :: DEBUGINFO )
84- . to_string_lossy ( )
85- . to_string ( ) ;
76+ let name = path. to_string_lossy ( filename_display_preference) . to_string ( ) ;
8677 ( name, None )
8778 }
8879 None => ( tcx. crate_name ( LOCAL_CRATE ) . to_string ( ) , None ) ,
@@ -116,7 +107,7 @@ impl DebugContext {
116107 endian,
117108 dwarf,
118109 unit_range_list : RangeList ( Vec :: new ( ) ) ,
119- should_remap_filepaths ,
110+ filename_display_preference ,
120111 }
121112 }
122113
0 commit comments