Auto merge of #106810 - oli-obk:resolver_reverse_plumbing, r=petrochenkov
Various cleanups around pre-TyCtxt queries and functions
part of #105462
based on https://github.com/rust-lang/rust/pull/106776 (everything starting at [0e2b39f](0e2b39fd1f) is new in this PR)
r? `@petrochenkov`
I think this should be most of the uncontroversial part of #105462.
This commit is contained in:
@@ -591,6 +591,24 @@ impl Input {
|
||||
Input::Str { ref name, .. } => name.clone(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn opt_path(&self) -> Option<&Path> {
|
||||
match self {
|
||||
Input::File(file) => Some(file),
|
||||
Input::Str { name, .. } => match name {
|
||||
FileName::Real(real) => real.local_path(),
|
||||
FileName::QuoteExpansion(_) => None,
|
||||
FileName::Anon(_) => None,
|
||||
FileName::MacroExpansion(_) => None,
|
||||
FileName::ProcMacroSourceCode(_) => None,
|
||||
FileName::CfgSpec(_) => None,
|
||||
FileName::CliCrateAttr(_) => None,
|
||||
FileName::Custom(_) => None,
|
||||
FileName::DocTest(path, _) => Some(path),
|
||||
FileName::InlineAsm(_) => None,
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Hash, Debug, HashStable_Generic)]
|
||||
@@ -2496,12 +2514,12 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options {
|
||||
early_error(error_format, &format!("Current directory is invalid: {e}"));
|
||||
});
|
||||
|
||||
let (path, remapped) =
|
||||
FilePathMapping::new(remap_path_prefix.clone()).map_prefix(working_dir.clone());
|
||||
let remap = FilePathMapping::new(remap_path_prefix.clone());
|
||||
let (path, remapped) = remap.map_prefix(&working_dir);
|
||||
let working_dir = if remapped {
|
||||
RealFileName::Remapped { local_path: Some(working_dir), virtual_name: path }
|
||||
RealFileName::Remapped { virtual_name: path.into_owned(), local_path: Some(working_dir) }
|
||||
} else {
|
||||
RealFileName::LocalPath(path)
|
||||
RealFileName::LocalPath(path.into_owned())
|
||||
};
|
||||
|
||||
Options {
|
||||
|
||||
Reference in New Issue
Block a user