@@ -29,7 +29,7 @@ pub(crate) struct DebugContext {
29
29
dwarf : DwarfUnit ,
30
30
unit_range_list : RangeList ,
31
31
32
- should_remap_filepaths : bool ,
32
+ filename_display_preference : FileNameDisplayPreference ,
33
33
}
34
34
35
35
pub ( crate ) struct FunctionDebugContext {
@@ -63,26 +63,17 @@ impl DebugContext {
63
63
let mut dwarf = DwarfUnit :: new ( encoding) ;
64
64
65
65
use rustc_session:: config:: RemapPathScopeComponents ;
66
- use rustc_session:: RemapFileNameExt ;
67
66
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 ) ;
70
69
71
70
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 ( ) ;
79
73
80
74
let ( name, file_info) = match tcx. sess . local_crate_source_file ( ) {
81
75
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 ( ) ;
86
77
( name, None )
87
78
}
88
79
None => ( tcx. crate_name ( LOCAL_CRATE ) . to_string ( ) , None ) ,
@@ -116,7 +107,7 @@ impl DebugContext {
116
107
endian,
117
108
dwarf,
118
109
unit_range_list : RangeList ( Vec :: new ( ) ) ,
119
- should_remap_filepaths ,
110
+ filename_display_preference ,
120
111
}
121
112
}
122
113
0 commit comments