1
Fork 0

Make local_crate_source_file return a RealFileName

so it can be remapped (or not) by callers
This commit is contained in:
Urgau 2024-03-19 13:51:22 +01:00
parent 106146fd95
commit ee2898d3f1
5 changed files with 23 additions and 14 deletions

View file

@ -99,9 +99,16 @@ impl DebugContext {
FileNameDisplayPreference::Local
})
.into_owned();
let (name, file_info) = match tcx.sess.local_crate_source_file() {
Some(path) => {
let name = path.to_string_lossy().into_owned();
let name = path
.to_string_lossy(if should_remap_filepaths {
FileNameDisplayPreference::Remapped
} else {
FileNameDisplayPreference::Local
})
.into_owned();
(name, None)
}
None => (tcx.crate_name(LOCAL_CRATE).to_string(), None),