1
Fork 0

Introduce FileNameMapping::to_real_filename and use it everywhere

This commit is contained in:
Urgau 2024-03-21 21:13:06 +01:00
parent ee2898d3f1
commit 4f4fa42b0e
6 changed files with 42 additions and 41 deletions

View file

@ -2842,13 +2842,8 @@ pub fn build_session_options(early_dcx: &mut EarlyDiagCtxt, matches: &getopts::M
early_dcx.early_fatal(format!("Current directory is invalid: {e}"));
});
let remap = file_path_mapping(remap_path_prefix.clone(), &unstable_opts);
let (path, remapped) = remap.map_prefix(&working_dir);
let working_dir = if remapped {
RealFileName::Remapped { virtual_name: path.into_owned(), local_path: Some(working_dir) }
} else {
RealFileName::LocalPath(path.into_owned())
};
let file_mapping = file_path_mapping(remap_path_prefix.clone(), &unstable_opts);
let working_dir = file_mapping.to_real_filename(&working_dir);
let verbose = matches.opt_present("verbose") || unstable_opts.verbose_internals;

View file

@ -252,8 +252,7 @@ impl Session {
}
pub fn local_crate_source_file(&self) -> Option<RealFileName> {
let path = self.io.input.opt_path()?;
Some(RealFileName::LocalPath(path.to_path_buf()))
Some(self.source_map().path_mapping().to_real_filename(self.io.input.opt_path()?))
}
fn check_miri_unleashed_features(&self) -> Option<ErrorGuaranteed> {