Skip to content

Commit 6a2b2b4

Browse files
committed
Introduce FileNameMapping::to_real_filename and use it everywhere
1 parent d6a817a commit 6a2b2b4

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

src/debuginfo/mod.rs

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ impl DebugContext {
8585
let mut dwarf = DwarfUnit::new(encoding);
8686

8787
use rustc_session::config::RemapPathScopeComponents;
88+
use rustc_session::RemapFileNameExt;
89+
8890
let should_remap_filepaths =
8991
tcx.sess.should_prefer_remapped(RemapPathScopeComponents::DEBUGINFO);
9092

@@ -93,22 +95,16 @@ impl DebugContext {
9395
.sess
9496
.opts
9597
.working_dir
96-
.to_string_lossy(if should_remap_filepaths {
97-
FileNameDisplayPreference::Remapped
98-
} else {
99-
FileNameDisplayPreference::Local
100-
})
101-
.into_owned();
98+
.for_scope(tcx.sess, RemapPathScopeComponents::DEBUGINFO)
99+
.to_string_lossy()
100+
.to_string();
102101

103102
let (name, file_info) = match tcx.sess.local_crate_source_file() {
104103
Some(path) => {
105104
let name = path
106-
.to_string_lossy(if should_remap_filepaths {
107-
FileNameDisplayPreference::Remapped
108-
} else {
109-
FileNameDisplayPreference::Local
110-
})
111-
.into_owned();
105+
.for_scope(tcx.sess, RemapPathScopeComponents::DEBUGINFO)
106+
.to_string_lossy()
107+
.to_string();
112108
(name, None)
113109
}
114110
None => (tcx.crate_name(LOCAL_CRATE).to_string(), None),

0 commit comments

Comments
 (0)